I have an OptixTraversableHandle object generated by using built in triangles. I updated meshAccel by applying OptixSRTMotionTransform. My question is :
how can I access updated vertices in the host side after applying SRT motion transform in Optix 7.2?
thanks in advance
My question is: how can I access updated vertices in the host side after applying SRT motion transform in Optix 7.2?
You don’t? The vertices in your geometry acceleration structure are still in object space. The SRT transform gets inserted to the current transform list on device side.
You need to calculate the currently active transformation matrix and its inverse when needed (for normals) and transform your object space vertex attributes with them.
Each of the motion transforms adds a step in the transform list. It’s a little involved to iterate over the current transform list and concatenate the matrices if the transform list is more than one entry deep. That’s why OptiX provides helper functions for those operations.
Please have a look into my small motion blur example which does linear and SRT motion on instances and camera motion blur.
I’m using the helpers inside the closest hit program here: https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/intro_motion_blur/shaders/closesthit.cu#L72
For applications which only use a single transform (IAS->GAS hierarchy) it’s more efficient to not use these general helper functions but just get the single transform.
Compare the above with this code:https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/intro_driver/shaders/closesthit.cu#L155
(I implemented my own point/vector/normal transformation functions in there because that was before OptiX added helpers for those as well.)
Please read through the
optix_7_device_impl_transformations.h header inside the OptiX SDK 7.2 or 7.3 to see the implementation of these helper functions.
If you really need the transformed vertices on the host at a specific time, you would need to implement the same concatenation of all transformations in the current transform list above the respective geometry on the host side yourself.