Is there a flag we can set on a GeometryInstance to have it skipped during ray traversal? Basically my scene is interactive with opengl interop, and I want to quickly being able to hide/show objects. I understand I can update the scene graph and mark it dirty, but I assume that will be slower than just setting a flag to skip an object.
Look into the OptiX API Reference for “Selector nodes”
[…]Selector nodes are used to dynamically switch between model sub-trees in the scene during ray taversal.[…]
using a visit program
Selector seemed to work. I declared a visibility variable and if it is false, the selector program does not select any child index.
You should actually test that.
Selectors will incur a significant impact on scene traversal which will reduce runtime performance.
Can this be done by checking for a variable on the instance in the anyhit program and if so ignoring the intersection?
I’ve done that with mesh lights to make them invisible to my primary rays.
yes, you could do that.
when doing it on any hit use rtIgnoreIntersection();
see example [url]https://github.com/nvpro-samples/optix_advanced_samples/blob/master/src/optixIntroduction/optixIntro_07/shaders/anyhit.cu[/url]
in “anyhit_cutout” the opacity is such a var, based on material settings, of course you could use directly a var .