Working with large meshes


I am currently working with very large triangle meshes. Until now, I’ve been using rtuCreateClusteredMeshExt(…) to internally format meshes for optimal paging performance.

The problem is that I need to track the id of the object to which an intersected triangle belongs. Currently I’m achieving this using separate material programs for each object in the scene, which are then called from the internal rtuCreateClusteredMeshExt(…) collision routine using the materialIndices argument (thank you for fixing this in Optix 3.0.1 btw!).

The problem is that there can be several thousand objects in a scene, and using a seperate material program for each object (where each program almost exactly the same thing) is causing significant warp divergance.

Is there another way to do this using rtuCreateClusteredMeshExt(…)? For example, is there a way to directly determine the primId of the intersected triangle found in rtuCreateClusteredMeshExt()?

If this is not possible, is there way to structure my mesh such that its corresponding acceleration structure (I’m using Lbvh) uses less memory? I’ve noticed a near order of magnitude difference in acceleration structure size when using my native meshes vs those produced with the clustered mesh routines.



I think it’s impossible now to directly determine the primId of the intersected triangle found in rtuCreateClusteredMeshExt. And using material id is the only workaround for the moment. You can define different materials but the same closest hit program for them, each material will have its own id in a variable. That will decrease divergence, but still it’s waste of material memory. The right thing would be to add primId attribute into the intersection program of rtuCreateClusteredMeshExt. This will be done in the next OptiX release.

In rtuCreateClusteredMeshExt cluster of triangles is a primitive for AS, that’s why AS is smaller. To decrease device memory consumption of AS you can also use BvhCompact traversal.

Hi qconst,

Thank you for your response. Currently, my solution is exactly what you proposed: using the same closest hit program for each material, and tracking ids using a variable associated with each material. Unfortunately, the performance is not great when I have 1000s different materials (objects) in once scene.

Being able to directly access the primId as an attribute would be great. Is there a rough release date planned for the next OptiX version?

Also, thank you for the tip to use the BvhCompact traverser. This possibility had slipped my attention.