I have recently implemented a surface renderer with Optix to visualize the VTK-HyperTreeGrid data structure.
This is a tree-based AMR, a grid of octrees, which represents a voxelized 3D scene.
To do this, I create an object for each octree, and I do a DFS to find the nearest visible node when a bounding box is intersected.
I use the closest-hit function to render the node.
But there is my problem, a DFS on GPU (made by a single thread per object) is pretty expensive. And Optix waits all rtReportIntersection or miss from intersected bounding boxes to determine the closest intersection and render it. So a DFS is made for each object intersected by each ray.
Here is my question : Is there a way to process objects one by one, from the nearest bounding box to the farest ? And, when an intersection is done, stop the process and return the result ?