Knowing which Hydra prims are visible in the rendering

I have a question about Hydra. This question is not about Usd stages primitives but rather about maya native node’s primitives which we translate to Hydra.
In maya, we need to know at the current time which prims are visible in the rendering. We need this so we can retrieve the maya nodes related to these prims and trigger the evaluation of the nodes’ graph with the evaluation manager.
What would be the most efficient way to get this information from Hydra ?
We are mainly using HdStorm but should as much as possible stay render delegate agnostic.
I was thinking we could render a frame with all geometries being overriden by bounding boxes in a filtering scene index so we could know which prim’s data have been pulled by the render delegate.
But we need to render a frame for that.
And ideally I would like to avoid rendering a frame just to get that information and would also like avoiding doing frustum culling of bounding boxes on the CPU.
So are there any better solutions ?
Thank you.
PS : This was originally a question posted on Slack USD WG : Slack

1 Like

Hi David!
At Pixar, we have a related use case for a pruning pipeline. For each frame in a shot, we generate an ID render and use it to generate a prune USD layer.
You can generate an ID render in both Storm and Prman (and possibly Embree), although the render task configuration is currently different for each of them. Note that the ID render differs from view frustum culling in that we render the actual geometry and not the bounding box approximation.

For your use case, I hope it isn’t a chicken-and-egg situation, where you need to know what’s visible to trigger evaluation of the nodes’ graph, but to figure that out, you need to render the actual geometry.

Hi Raja !

Thank you for for your reply.
Actually what we are going to do is do the frustum culling from the bounding box on the CPU.