Problems with >2 rtObjects

I’m initializing a context with multiple entry points in order to run traces against three different meshes with two different ray-generation programs (so there are 2 entry points). It works fine when I’ve set two rtObject variables, but when I set three, suddenly the rtTrace calls fail-- the exception program is called with UNKNOWN_ERROR.

Is there any known reason why two rtObjects would work but not three? It’s not a memory issue, because the same error occurs even if all three meshes are trivially small. Simply commenting out the line where I set the third rtObject variable fixes the error. I can work around the problem by reusing a variable–setting different rtObjects before each rtLaunch to the two entry points-- but that’s very slow.

Any insights would be helpful!

I have no explanation for the failure with three rtObjects with the given information.

If you need to frequently switch between different models to render, the recommended approach would be to use a selector node under the root with a visit program which selects one of the sub-trees to traverse.
That way there is only one top object, no variables are changed which might induce a recompile, and there is no scene change (no acceleration structure rebuild) when rendering different parts of the scene.

Just to rule out things: did you initialize the programs for the third entry point?

Thanks, the selector is the solution I needed. I must’ve skipped that part of the documentation!

Mark-- I did initialize the programs… but no worries, I was going about it the wrong way anyway. Thanks!