Hello,
When creating geometry triangles objects, we have two ways to define their vertices positions, as explain in the programming guide https://raytracing-docs.nvidia.com/optix_6_0/guide_6_0/index.html#host#3519
The simplest is to only put coordinates into the vertex_buffer, and each triplets of vertices correspond to a triangle.
The second one is to put all the coordinates into the vertex_buffer in an arbitrary order, and to add an index buffer who will give the correspondence between three vertices and a triangle.
If I understood them correctly, all OptiX examples use the second method, and in the “mesh_attributes” program, get the triangle coordinates through the index_buffer.
As I don’t need the textcoord or the normal attributes for the vertices, I use the first method, without the index_buffer.
In the “mesh_attributes” program, I get the vertices position like this:
int primIdx = rtGetPrimitiveIndex();
const float3 v0 = vertex_buffer[primIdx];
const float3 v1 = vertex_buffer[primIdx+1];
const float3 v2 = vertex_buffer[primIdx+2];
It seems to be correct. Can someone confirm it?
Thanks,
Arnaud