Optix 7 analogue of Uniform Buffer Object for transformation matrices

In Vulkan or OpenGL, thanks to GLSL, one passes transform(scale, rotate, translate) matrices to vertex shader via UBOs.
What is the canonical way of achieving this in OptiX? Do I pass the matrices via Launch Parameters and apply them to ray generation(in reverse order may be?) or is there another mechanism of the API to achieve this.
It is for something as simple as rotating a particular triangle while other objects are stationary. I can target the particular triangle via instance id, if there is not a slicker way.

You cannot simply animate individual geometry in a ray tracer like that because all spatial information gets stored inside acceleration structures during the geometry acceleration structure build.

Means when animating a huge number of individual primitives, you would normally do that by applying the transformations to the geometric primitives yourself in a pre-process, best with a native CUDA kernel since the data should reside on the device for the following acceleration structure build anyway, and then build the geometry acceleration structure (GAS) over the resulting vertex positions every frame.

That sounds slower than it is. See this thread: https://forums.developer.nvidia.com/t/delete-remove-geometryacceleration-best-way-to-go-about-it/160829

If you only have a few geometries to transform of which the topology doesn’t change, you would do affine transformations of that GAS with the 3x4 transformation matrix of an instance above that, and rebuild or update (refit) that instance acceleration structure (IAS) each frame. This is actually pretty fast.

Another nice example video for that in this thread: https://forums.developer.nvidia.com/t/thanks/123134

A simple example with IAS updates for an animation timeline with motion blur can be found here:
https://github.com/NVIDIA/OptiX_Apps/tree/master/apps/intro_motion_blur

1 Like