Progressive refining in SDK Sample 6

Good day,

I would like to try implementing progressive refining (as is done in the SDK Whitted example) into Sample 6 of the SDK. How should I go about doing this? It looks like the spheres in Sample 6 are not 3D models, but drawn with code. Sample 6 makes use of a 3D model. Does this change how I should approach this?

So far it seems that I will have to rewrite the pinhole camera cuda file and make only minor changes to the cpp source files. Do you agree?

Basically I’m just trying to wrap my head around how to approach this.



Yes, you could use the ray generation code (adaptive_pinhole) in sample6 and copy the corresponding code that sets up the random number generator seeds in the host code.

Note that in general, the camera code doesn’t care what sort of geometry is present in the scene. A ray intersection is a ray intersection regardless if it came from an implicit surface evaluation, a triangle from a mesh, or some other procedurally generated geometry.

I can use coarseTrace with my code, but the jittered_trace function does not work yet. The following line of code seems to be the problem:

float3 result = trace( offset +  make_float2( index ) );

The error I get when using jittered_trace is:

terminate called after throwing an instance of ‘optix::Exception’
what(): Unknown error (Details: Function “RTresult _rtContextLaunch2D(RTcontext_api*, unsigned int, RTsize, RTsize)” caught exception: Encountered a CUDA error: Kernel launch returned (700): Launch failed, [6619200])
Aborted (core dumped)

I am using the functions from and have copied the other code as you suggested. I have the following questions:

  • What does jittered_trace actually do?
  • How does OptiX know when the user has moved the viewpoint of the camera in the Whitted example? I cannot see how the frame_number value is reset for any mouse movement (like when the user clicks and drags across the scene)
  • Fixed the problem. It was specific to how I handled things in my RTPROGRAM.