Author Topic: Order of Operations  (Read 146 times)

What is the order of operations for processing a material in Designer? Does the execution start at the output or the input?

For example, if I have a multi-switch node that inputs 10 variations and chooses a single image based on an index, does the processor need to generate all of the other 9 variations and throw them away?

If the processing works backwards, then only what is needed would likely be generated. But if it starts at the input node, I'm assuming every possible outcome is computed for every execution, even if only a fraction of it is used.

Thanks for any help!

You are right! If you set up your graph correctly, it only renders what is needed. Anything not connected to an active output is ignored.
"Better than some, no worse than others."

That's great. Is that the case when "what is connected" depends on user input? For example, if I expose an index that dictates which option of the multi-switch node is used, and the user/Substance Painter/etc sets that option to 2, does the material processing algorithm completely avoid processing the input connectors 0, 1, 3, 4, 5, etc, of the multi-switch node?

Another (exaggerated) example:

10 minutes worth of node processing is connected to -> input connector 1 of multi-switch node (off)
5 minutes worth of node processing is connected to -> input connector 2 of multi-switch node (off)
3 minutes worth of node processing is connected to -> input connector 3 of multi-switch node (on)
-- If I processed this material, would it take around 3 minutes or closer to 18?

Thanks again!
Last Edit: February 09, 2019, 10:06:54 pm

You are entirely correct again!
To make the clear even clearer, here's an example.


Designer is well-optimized as long as you use it correctly.
For example, remember to set blend notes to "switch" when using them for switching. That way it won't render the unused chain of nodes.

If you're interested in further reading, Allegorithmic has made an optimization guide.
https://support.allegorithmic.com/documentation/sddoc/performance-optimization-guidelines-102400075.html
"Better than some, no worse than others."

Thanks for your help! Knowing this gives me a lot of flexibility.