Author Topic: Best place to initialize variables in a pixel processor?  (Read 109 times)

What would be the best option for initializing variables in a pixel processor node? I'm trying to setup some variables that will be used inside the pixel processor before the processing actually begins.

I tried using the "output size" function to generate variables, but for some reason, Designer doesn't always execute that function when the graph loads up. So the processor ends up being executed without the variables being initialized. I have to tweak some of the exposed variable values to get them to initialize.

Does anyone know why this happens, or if there is a safer way to initialize them outside of pixel processing?
Last Edit: May 08, 2019, 04:27:10 pm

With the new 2019.1 version, you can now declare variables in their own nodes in the texture graph and plug them as input of a Pixel Processor:
https://www.allegorithmic.com/blog/substance-designer-spring-2019

Yeah, I'm loving the concepts of the new engine, but I'm not completely in line with the logic (my brain is lagging behind). Would I need to setup 4 separate value processors and plug all 4 into the pixel processor for something like this..



On another version of the same processor type, I'm setting 12 values. Would I need 12 logic processors and 12 inputs? Or is there a way to stream multiple data connections?

Another concern is randomness. If I make 4 logic processors that do the same random thing, will they all come out identically unless I manually set their random seed? Would there be any way to force each execution to be different (like force it to use the external/parent random seed)?

Is this new stuff in a manual somewhere?

Thanks for the advice!
Last Edit: May 11, 2019, 04:25:08 am

To initialize variables, it's probably best to do that inside the Output Size function.
Product Manager - Allegorithmic

You can use the 'global random' node to set a predictable seeded random inside a function. It always returns the same value if the seed integer and input float are the same, no matter what random seed the parent node or graph has.
This does mean it won't randomize per pixel either. So if you want to make a white noise with it for instance, you'd need to index pixels to different seed values.
Esger van der Post.
Game design student and texturing addict.