A question about performances optimization

Hello all!
In my network I have a few 3D objects. Each of them is created with a bunch of TOP, CHOP, SOP, etc.
I don’t want to show them all together, but just one at a time.
So I’ve a constant CHOP, from 0 to 8, with a Fan CHOP to split each value (obj1active, obj2active, obj3active, etc…).
With these values I can control the “rendering” parameter of each Geometry COMP, and that’s great, because in this way just a Geometry COMP is rendered,
But I’m wondering if I can bypass (not cook?) all the operators that create each Geometry COMP.
I’ll try to explain better:
if I should write code in c# I could write (please forgive me for the very raw code)

if (modelNumber == 1) CreateCube();
if (modelNumber == 2) CreateSphere();
if (modelNumber == 3) CreateMyFunnyHeadDisplaced();
....

In this way the code is only executed on the basis of the “modelNumber” variable
Is there a way to the same with TD operators?
Many thanks!!

Nodes will only first cook when they are used (viewed, rendered). So if you don’t have the Render flag on for the Geometry COMP (and you arn’t viewing the node viewers for any of the nodes), then the underlaying nodes (SOPs, TOP etc) won’t cook yet either. They will first cook first time they are actually used.

More information here:

Wow, this definitively let me understand how TD work!
From a coding perspective “A common misconception with cooking in TouchDesigner is that cooking starts upstream and moves downstream” is absolutely inunintive and a valueable information.

  • So I assume that if all the render flag are set to off, and all the operators that contribute to create the geometry are set not visible, nothing (except a couple of external operators) should be cooked, isn’t it?

  • As far as I can understand is crucial not to have any of the operators visible, to maximize the performances. Is there a way to toggle on/off the operators with visibility set to on? For debugging purposes I may need to keep some operators visible (cooking), and quickly switch to an optimized version of the network to check the performances.
    Maybe with the “perform mode” ?

Really many thanks!
Sorry for my newbie and maybe stupid questions

You can safely leave the viewers on, it’s only when you actually are looking at them in the network editor that it matter. So when you enter a network, if the viewers are on, then those nodes will cook.

When you are in Perform Mode and you arn’t looking at the network at all, then the viewers for the nodes don’t matter.

1 Like