I know this isn't the primary goal of OptiX but it is relevant when ray marching (sphere marching) signed distance fields so I figured I'd try. I created my own BVH for this originally but I was hoping to benefit from all the recent ray tracing work and RTX acceleration.
I will assume some basic familiarity with the OptiX 7 API.
My initial attempt involved setting the optixTrace
ray direction to {0, 0, 0}
but this only triggers intersections for shapes where the ray origin is inside the AABB (makes sense). I then set the ray direction to {inf, inf, inf}
which seemed to trigger intersection calls for every primitive regardless of AABB distances or reported tMax
values.
I played around with a few other combinations of ray directions and tMax
/tMin
values and I considered the various OPTIX_RAY_FLAGS
but nothing seemed like it might work.
Ideally, it would be nice to query only bounding boxes that are within tMax
distance from the ray origin. This is obviously a different check than a ray-aabb intersection but I was curious if there might be some API flags/masks/functionality I'm missing that would allow for this. Direct access to the acceleration structure hierarchy could help here too but I didn't see anything about that in the programming guide.