Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Running Python Function as a Node

New Here ,
Aug 13, 2024 Aug 13, 2024

I have a custom Python function that manipulates images. I want to run this function in a graph, possibly as if a node. How can I achieve this in Substance Designer?

Both the input and output of the function is an image. 

TOPICS
How to , Scripting , Substance Graph
299
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 13, 2024 Aug 13, 2024
LATEST

Unfortunately this is not possible, there is no python node which can execute a python script. But I think there could be two workarounds which may fit you needs.

The first way is to export the input image from your graph, run that python function via a button, or shortcut or anything and export the result from python. Import that image back in designer and work with it. This way is depending on a lot of manual user interactions, so I wouldn't go with this.

The second way would be to create a Pixelprocessor with your function inside and use the image as input to the Pixelprocessor. Depending on your function in python you may have to make small adjustments but in theory the Pixelprocessor can do such things easily. If you convert your python function to a "Pixelprocessor function" it may help that the Pixelprocessor works like a shader and is very related to OSL or GLSL so you can usually first rewrite your function in a shadertoy.com adjust it there and then translate it into a Node-Based function inside the Pixelprocessor.

 

If you have more questions on that topic, don't hesitate to ask, if you want to provide the Python function I may have an idea how to translate it into a Node-Based function.

 

Stay healthy and creative Marco 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines