Organizing a file with different scenes

Hello touchdesigners!

I’m very new to Touchdesigner, and I committed to a VR projection mapping experience of a few minutes. The idea is to travel through different environments (different geometries, textures etc). Now I noticed that realtime performance can add up so I’m looking for way to make sure that only the things render relevant to a certain timeframe to keep performance on point.

So my question is;

How do you que different scenes and how do I make sure the scenes are not doing things in the background when they are not visible?

What are simple ways to improve performance? What components you guys use to manage more complicated projects?

1 Like

This is a great question and I’m hoping somebody else with more experience jumps in.

I can tell you where I’d start, though.

I think the Switch node is your friend. You might lay down a Base COMP for each scene, then inside each COMP, put the assets & logic for each scene, one at a time. Use a top level Switch node to switch between the different scenes according to whatever logic you want. This could be a length of time/ number of frames, or an action taken in one of the scenes (“Goal Reached”, say), or some other combination. One easy thing to do would be to store that information in a top-level DAT table, and then refer to that DAT in an expression in the Switch node-- if you have 5 scenes, then your Switch expression needs to evaluate, one way or another, to a number between 0 and 4.

I can imagine some extra wrinkles that might be present if you wanted to transition smoothly from one scene to the next, or if you were loading big files that caused slowdowns on data load; you might have to make one scene begin a few seconds before the previous scene ends-- but those are all details you can work out once you’ve got the general architecture in place.

The important thing is that nodes don’t, in general, cook or consume resources if they aren’t being used. I wish I understood the details and caveats a little better (anybody else who wants to chime in, please do!) but as a starting point, I’d say just to put all of your non-shared resources in separate COMPs with appropriate outputs (TOPs and Audio CHOPs?), and switch between them algorithmically.

Hey man thanks for the advice! I will check it out as soon as possible!

For more information when nodes cook and why, see this page on the wiki:
As Evan said, it’s important to realize TD is a pull based system, so nodes only cook when something is requesting their output. Key paragraph on that wiki page:

The Order of Cooking
TouchDesigner is a “pull system”. A common misconception with cooking in TouchDesigner is that cooking starts upstream and moves downstream. For example if you have Constant CHOP connected to a Math CHOP, most people assume if you change a value in the Constant CHOP then the Math CHOP is forced to cook. This is incorrect. Almost all operators will only cook when something is interested in their data. What this means in our example is that while changing a parameter in the Constant CHOP will make it ‘dirty’, it won’t cook until someone asks for its data. So the Constant CHOP won’t cook until the Math CHOP asks for its data. The Constant CHOP may cook for other reasons, like if its viewer is on (ie. the user is asking to see its data).

Here a basic example which shows that effect:
base_cooking_optimization_example.tox (1.6 KB) Unfortunately there is a very annoying bug in current official 2019.19930 where it does not show cooking of a COMP if you hold MMB on a COMP, so this example is much clearer if you open it in latest experimental. Anyway, if you open this network you’ll see an animated wire going from base1 to the switch, which means the node from which that wire is coming (base1), is cooking.
Normally, if you hold MMB on base1 and base2 you would see only base1 is cooking. (you’ll see this indeed if you open it in experimental or older official releases)
Now click the switchme button, and you’ll see now that only the wire between base2 and the switch is animated, and MMB on both COMPS would reveal only base 2 is now cooking.

For more inspiration how to organize your network for switching scenes, see this “Bare Bones Scene Change Show System” made by Jarrett from Derivative.

1 Like

One thing to note about the Switch TOP is that if you have the blend between inputs turned on it will cook all tops to that are connected to it. If it is turned off only the selected input cooks. You can run multiple Switches into each other to make sure only the things that you need are cooking.

1 Like