[Resolved] optixPathTracer undesired fading between frames despite camera movement

Hi. Since I upgraded to Optix 4, I noticed that the optixPathTracer sample has some new behaviour: when the camera is moving I’ll sometimes glimpse a frame that looks as if it’s fading between the preceding and succeeding frames. I tested this by writing all frames to files and found that indeed the frame buffer sometimes contains two frames, faded between. Since there is code in place to explicitly reset the buffer in case of any camera movement, I’m a bit at a loss as to why this is. I’m sure it wasn’t there in the OptiX 3.9.1 SDK. Was it added on purpose? And more importantly: any pointers for getting it to behave like it did in OptiX 3.9.1?
Thanks in advance for any help.

I haven’t seen this behavior. Is there something I can to do reproduce it easily? Given that the OptiX launch() call is synchronous, and the GLUT event loop is single threaded, I’m not sure where a syncing issue like this is sneaking in.

Btw, how are you writing all frames to files? Did you hack the sample a bit to basically act like you pressed the ‘s’ key after each frame? If so, I’m curious what happens when you pass the “–nopbo” flag to the sample, which skips GL interop.

I can see that as well when making the optixPathTracer fullscreen and zooming in to make it slower.
Then it’s best seen when dollying in and out (RMB drag) which results in some visual fading effect for a short period of time.

The problem is that frame_number is not reset at the correct location when camera_changed == true.
The fix is simple. Just move two lines of code in updateCamera().

if( camera_changed ) // reset accumulation // FIX: Reset frame_number before setting the OptiX variable.
        frame_number = 1;

    context[ "frame_number" ]->setUint( frame_number++ );
    context[ "eye"]->setFloat( camera_eye );
    context[ "U"  ]->setFloat( camera_u );
    context[ "V"  ]->setFloat( camera_v );
    context[ "W"  ]->setFloat( camera_w );

    // if( camera_changed ) // reset accumulation // BUG: Too late!
    //    frame_number = 1;
    camera_changed = false;

Hah, look at that. Yeah, that’s a bug, thanks for catching it. I just fixed it in our dev branch. I obviously need to test on slower GPUs :)

And here I was, thinking I had a pretty decent, new GPU. :P
Thanks to you both for the feedback and catching the bug. Happy to have spotted it. :j