Now, I’m trying to use it for multiple (non-uniformly sampled) key frames.
That’s already the problem. OptiX doesn’t support non-uniform motion intervals.
Read the very first paragraph here: https://raytracing-docs.nvidia.com/optix7/guide/index.html#acceleration_structures#motion-blur
“Motion blur is supported by OptixMatrixMotionTransform, OptixSRTMotionTransform and acceleration structure traversables. Several motion blur options are specified in the OptixMotionOptions struct: the number of motion keys, flags, and the beginning and ending motion times corresponding to the first and last key. The remaining motion keys are evenly spaced between the beginning and ending times.”
That links to the older OptiX 6.5 Programming Guide for more information about how the motion indices are assigned to times:
https://raytracing-docs.nvidia.com/optix6/guide_6_5/index.html#motion_blur_math#motion-blur
You would need to resample your animation steps into evenly spaced key frames.
[1] I can set the time interval (e.g., [0,1]), but how can I set the time for a particular key frame?
You can’t. They need to be evenly spaced.
[2] I set more than two transformations; however, it’s not working properly in my opinion. I tried three same transformations, but some artifacts appeared.
What kind of artifacts? (Screenshot?)
Please always provide your system configuration when asking about OptiX issues:
OS version, installed GPU(s), VRAM amount, display driver version, OptiX (major.minor.micro) version, CUDA toolkit version (major.minor) used to generate the input PTX, host compiler version.
There had been a bug when using more than two key frames which was solved in more recent drivers.
Please update to the newest available display driver for your configuration and try again.
What kind of motion did you apply? Linear, SRT, or geometry.
When using SRT, mind that rotations between two key frames must not exceed 180 degrees or the rotation will not be around continuous directions (means the rotation axis can flip).
When using OptiX versions before 7.2, you were responsible for providing AABBs covering that movement of your instances. Because OptiX 7.2 removed that requirement I would recommend using that when implementing motion blur. It makes things much easier.
See this comment in my intro_motion_blur example (which is using only two keys from animation frame to animation frame):
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/intro_motion_blur/src/Application.cpp#L1780
[3] I don’t understand why I have to set again the time interval and the number of key frames in OptixAccelBuildOptions as it is already set in OptixMatrixMotionTransform for individual nodes.
That’s required because each OptixMatrixMotionTransform could have a different setting and the builder needs to know how it should resample the underlying motion intervals if they differ.
Don’t overdo it with the number of key frames. That will require additional memory.