I have a lot of triangles placed in the scene, and I want to get some specific triangles by shooting rays at some specific places. Are there any factors that can affect the traversal speed of BVH? For example, the size of the triangles, the distance between triangles, the density of triangles or the length of rays. Thank you!
Are there any factors that can affect the traversal speed of BVH?
Yes, please read this thread and take note of the AS compaction and different AS build flags. Follow the links to them inside the OptiX Programming Guide.
Then read this thread again because it touches on the acceleration structures and geometry flags as well:
Try to avoid nesting AABBs of things inside each other.
If you just have independent triangles in a single GAS, that might not affect you. If the geometric primitives penetrate each other or if there are huge differences in their AABB extents so that AABB overlap a lot, that would affect traversal performance,
You would need to benchmark that yourself for your specific use case.
The ray [tmin, tmax] interval length could affect the traversal performance greatly.
Obviously the shorter the rays are, compared to your scene size, the fewer AABB can be intersected.
This might also be interesting when considering how to implement the individual device programs.