Built in Triangles - Normal with OptiX 7.2

There are different method how to make vertex attribute data accessible to the shader programs.
Available methods depend on the render graph hierarchy you’re using.
In the end it boils down to the question:
“How can I get a pointer to device data per GAS to be able to index into it with the current geometric primitive index.”

If you’re just using a single GAS, then all vertex attributes can be held in linear buffers, either one with interleaved data or one per attribute. The CUdeviceptr(s) would then simply be put into your constant launch parameter block and can be accessed from any shader program.

If you’re using the usual two-level architecture with IAS->GAS structure there are more options and it depends on the way you’re want to structure your SBT. Mind that there is the user defined instance ID and SBT offset fields per instance which can be used to index into user defined data.

I explained the different options multiple times before.
Check this post and read all four forum threads linked in there and concentrate on my answers.
https://forums.developer.nvidia.com/t/explaining-hitgroup-records-creation-in-sutil-vs-path-tracer/201777/2

I am trying to build a “box” from triangles, so I probably need to compute normal to a given face versus individual triangle.

These normals should be the same anyway. Just look into my code. I don’t even calculate them. In object-space they are the six unit vectors, two on each coordinate axis.

1 Like