Switching between multiple geos and environment lights

I have a project that consists of multiple 3D ‘scenes’. These are different Geometry COMPs and Environment Lights that I swap between. Currently I switch by dynamically changing the geometry and lights params of a single Render TOP.

This works but upon switching scene the first time there is a frame drop while things get loaded. I tried running a script at startup to force cook the geos etc before switching to them but this doesn’t solve it for some reason. If I render everything to screen on frame 1 then it runs smoothly from then on.

Before I dig deeper, just wondering what the recommended strategy is for this situation? Better to somehow get everything into memory with the setup I have or to use multiple Render TOPs or…? It seems like the sort of thing others must have run into :slight_smile:

Many pieces in Touch are pull based, and may not be initialized unless they’re rendered. Case in point, your geometry might be cooked, but the material that’s using your environment light might not be. Multiple render TOPs will likely encounter the same issue, as when they cook for the first time, you may see a frame drop while the rest of the components load / are initialized.

To your point, a recursive cooking approach can often help with this (you can forceCook, recurse=True to catch all of the children in a base), though the easiest immediate fix might be to just cycle through each of your scenes for 1-2 frames so that all of the components load. On start up cooking each of the pieces that I might need is a solid approach. If you can transition through a black out, you can also do your path swapping while in black out, or while in a static screen.

That all makes sense, thank you. I did some more work on this…

  • I found that force cooking recursively of the geo COMPs, the lights, the materials, the SOPs, did not help. I thought this was going to be the elegant solution and I’m not really sure why it doesn’t work but I had to abandon it.
  • I then thought it’d be smart to render all my geos and materials at once for a frame at the start in a single render TOP (I simplified to one environment light for this test). But as soon as i switched to my regular scenes it didn’t seem to maintain that cache. Maybe this approach is worth revisiting but giving it more than a single frame given what I learned below.
  • Cycling scenes for a frame each also didn’t work. I suspect that with some of the scenes taking a while to load, other scenes were somehow skipped in the frame drop.
  • So far, the only solve I have is to cycle all the scenes for 0.5secs each to give them time to fully load. It feels very inefficient and slow but reliable! :man_shrugging: