-
If I have a ray that intersects some objects in the scene but not others, is there a good/efficient way of identifying the non-intersected objects? I run into memory issues when I try to find these objects by first storing the set of intersected objects and then comparing it with the set of all objects. All of the objects in the scene are spheres. It seems like the Miss program does something similar but is only invoked when the ray intersects none of the objects. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The RTX "miss" program gets called if a ray has hit NONE of the objects; so that won't work for what you need. Generally speaking there is no built-in "RTX mechanism" for iterating over all prims not hit by a ray - in all my years of working in ray tracing nobody has ever even asked for that, probably because for most real-world scenes (with millions to billions of primitives) this would be shockingly expensive. So no, i can't think of any way other than starting with an array of all-ones (one per sphere), and then setting those that got intersected to 0 in an anyhit program. You could try to use a single bit per sphere, but that's still O(N) storage. |
Beta Was this translation helpful? Give feedback.
The RTX "miss" program gets called if a ray has hit NONE of the objects; so that won't work for what you need.
Generally speaking there is no built-in "RTX mechanism" for iterating over all prims not hit by a ray - in all my years of working in ray tracing nobody has ever even asked for that, probably because for most real-world scenes (with millions to billions of primitives) this would be shockingly expensive.
So no, i can't think of any way other than starting with an array of all-ones (one per sphere), and then setting those that got intersected to 0 in an anyhit program. You could try to use a single bit per sphere, but that's still O(N) storage.