The animation in my Optix7 program does not work correctly

Hello!

I created an animation, it can be displayed correctly when I move the camera, but when I don’t move the camera, it can’t be displayed correctly like being interpolated. I checked the code and found that it was caused by subframe_index . When the camera is not moving, a program similar to interpolation is executed. Is there any way to solve this problem? By the way, I am using a path tracing algorithm.

Thank you for your help!

If you’re using a progressive path tracing algorithm which accumulates the converged final image over multiple sub-frames (samples per pixel), then this progressive rendering will start from the first sub-frame after each change to the view to generate the new final image from scratch.

If you’re using an animation and you do not reset the sub-frame index to the first sub-frame but still advance your animation every sub-frame, then your animation will simply accumulate over each other at different sub-frames which generates a kind of stutter blur effect with the animation smeared over the final frame.

If you want to have the animation rendered out to converged final frames, then you would need to have two nested loops in your application, one over the animation frames (the full result images) and one over the number of sub-frames you want to accumulate per final image so that each animation frame starts at the first sub-frame and accumulates all samples per pixel you define.

If you just want to animate the object every frame, and have it shown as quickly as possible, than it you would need to reset the sub-frame index every time the view or the animation changes. Exactly the same thing as above but not rendering all sub-frames for each animation frame.

An example of something like that can be found in one of my OptiX 7 examples which implements linear and scale-rotate-translate (SRT) motion blur.
That has a simple animation moving and rotating two cubes by changing some values in an animation timeline or the camera interactively and accumulates the current animation frame only.
Look at the intro_motion_blur example here: https://github.com/NVIDIA/OptiX_Apps
The restartAccumulation() function in there resets the rendered sub-frame index to 0 to start a new image accumulation. That example will “animate” while you’re changing the current frame in the GUI and converge to a final frame as soon as you’ll stop interacting.

Thank you for your answer!

Yes, as you said, I want to have the animation rendered out to converged final frames. But I feel confused about the method as you said, I hope you can explain it in detail, if you can, can you post the example code, it may help me a lot.

About the advanced samples, I can’t install it correctly, it failed at installing the 3rdparty library, the generator has already install correctly , but the error like this:

E:\chung\Program\OptiX_Apps-master>"C:\Program Files\cmake\bin\cmake.exe" -P 3rdparty.cmake -DCMAKE_INSTALL_PREFIX="3rdparty"

cl_architecture = x64
CMake Error at 3rdparty.cmake:81 (message):
  no generator found, exit

Thank you for your answer!

If you pulled that github repository you already have the code I mentioned.

Search the *.cpp files inside the intro_motion_blur example for the restartAnimation function. It’s called whenever the camera or animation GUI parameters are changed.

Also look where the m_iterationIndex, which is set to zero in there, is used in the rest of the code to set the sub-frame index inside the renderer on device side. It’s this variable on the device side in the OptiX launch parameters:
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/intro_motion_blur/shaders/system_parameter.h#L65

You would need to change your own code to work similarly with whatever your animation frames and rendered sub-frame indices are. Mind that these examples are a little more involved than the simpler OptiX SDK examples.

On the 3rdparty.cmake script issue:
It seems you ran the 3rdparty.cmd inside the proper x64 Native Tools Command Prompt for VS2017 or x64 Native Tools Command Prompt for VS2019 because it detected the cl.exe 64-bit architecture.

That the 3rdparty.cmake script wasn’t able to detect the MSVS version from the cl.exe version string is most likely due to a different language localization than English.
The regular expression
string(REGEX REPLACE ".*Version (..).(..).*" "\\1.\\2" cl_version ${cl_info_string})
looks for the string "Version " and two two-digit numbers separated by some character.
That can fail for non-English localizations of the compiler which have a different string than Version there. (That happened for Spanish in the past.)

In that case, just execute the cl.exe inside your x64 Native Command Prompt for VS and look at what version it reports.
There is a table further down in the 3rdparty.cmake script which maps cl.exe versions to MSVS versions.
Then you can either change the regular expression in line 36 to match your language or simply hardcode the VS generator in the if-else blocks at line 62 https://github.com/NVIDIA/OptiX_Apps/blob/master/3rdparty.cmake#L62

E.g. if you’re using MSVS 2019, keep these two lines:

  set(GENERATOR "Visual Studio 16 2019")
  set(MSVC_TOOLSET "msvc-14.2")

For the rest of the 3rdparty pre-requisites and the build process, please follow the README.md by the letter.