I want to import my geometry from a GLTF file and have OptiX assign each primitive a unique ID.
I am starting from the optixMeshviewer example and am using the tinygltfloader by syoyo.
I proceeded as follows: I export a scene from blender as GLTF (in my case just two cubes) and then import them in OptiX just as done in the example. Since GLTF reuses the same mesh in the two nodes (am I understanding this correctly) the triangles of the two cubes share the same primitive IDs.
More specifically, My hitcounter buffer only registres hits in the first 12 entries. The primitives 12-23, which should correspond to the second cube, stay at 0 hits even if I move around the camera.
I tried to work around this by adding the two cubes to the same mesh, but still they share the same IDs as if they were two separate GLTF primitives.
Now I was wondering if this an exporting problem, or if I have to modify the importing routine. In the documentation I did find the OptixBuildInputTriangleArray Struct with the primitiveIndexOffset value. In the code I couldn’t find a reference to this struct, but I think if I can pass the number of previously imported triangles to this struct, it should start incrementally indexing the triangles of the next processed node/GLTF primitive.
Could you point me in the right direction where I have to change the code, as right now I am completely clueless where to start. Your help is very much appreciated!