I have a scenario, where I have a lot of scenes in small thumbnail viewports and a couple of big render viewports with more complex scenes.
I am using hydra directly via a setup of custom rendertasks and scene indices, which get data from our internal non USD datasources.
To achieve multiple scenes I am plugging one scene index with a special scene root prefix for each scene into my render index.
At render time I am rendering scene by scene with HdEngine::Execute() after I switch the current collection for my render tasks.
The collection just has the appropriate root prefix set to filter for the appropriate scene prims.
However, this approach doesn’t seem to be that performant as I hoped. It looks like there is much more synch work involved when switching scenes.
I guess SetCollection causes a resynch of all prims of all scenes to filter for the prims in the correct root path?
Another idea was to use multiple HdEngines with its own render delegate, but this could imply huge memory waste.
Yet another idea is just switch scenes by having one scene index, where all scenes are contained in subtrees but instead of collection setting, set the scene prims visibility to switch scenes.
However I am not sure whether this is more performant than my current approach.
So my question is: How can I render multiple scenes per frame in a performant way with HdStorm/hydra, so that it can reuse as much resources as possible? Is there a recommended way?
If you’re trying to render a different scene per viewport (where there isn’t overlap in the scene hierarchy amongst scenes), then, the simple and performant option would be to use a unique hydra stack (scene index / render index / engine / render delegate) for each viewport.
If you’re trying to render different views of the same underlying scene, then the task collection approach works better. Each viewport should have its own task(s) instead of sharing tasks amongst the viewports and thrashing the collection in the process. This seems like the smaller change in your case, so I’m curious if this works out. Cheers!
Hi Raja, i just switched to an extra task set per viewport. However it didn’t get better. In fact it even got worse, because now each task set has to build its own shaders and cache things before it is ready. I guess this approach will let me change viewports, which are already loaded completely for rendereing more quickly. As it is now, the bottle neck is rather loading performance. Ideally there must be a way to load all the needed shaders and reuse them for all small scenes, so that each thumbnail only has a light wight hydra overhead. If i would do a full hydra stack (render delegate and all) per thumbnail, the loading times would go higher still probably. After loading it would get better i guess. However, i am using hundreds of thumbnail viewports in a scrolllist and loading time really matters here. Maybe i will try the hiding approach. Just put all the thumbnails together in a special scene and just use the same viewport for each thumbnail and switch the scenes by making the appropriate subset visible and hide the others.