I am looking to add support for ray differentials to a path tracer. I am working from the rayDifferentials and path_tracer sample projects in the OptiX 3.9.1 SDK.

Let me note that I am aware that the stochastic nature of path tracers prevents aliasing effects. I want to use ray differentials for lodding purposes.

Learning from example by looking at rayDifferentials, I believe to understand the structure in which the programs are set up to support ray differentials. The camera program is responsible for generating the initial directions per ray (using the helpers.h function differential_generation_direction). From that point on, the intersection programs calculate relevant differential data which is passed on to the closest hit programs for further processing and to be used for rendering.

I am currently facing a few challenges.

In the sample, the parallelogram intersection program passes on the variables dudP and dvdP, while the sphere intersection program passes on the variable dNdP. Because the sample is a ray tracer, only the reflective/refractive spheres cast new rays (in their closest hit programs). They do this by passing dNdP (the sphere’s curvature) to the helper functions differential_reflect_direction and differential_refract_direction. There is no example of reflection/refraction by a plane.

I also noted that the parallelogram intersection program is correct for rectangles in the XZ plane only.

To get ray differentials working in path_tracer I will need to find a way to support parallelograms in all possible planes. I will also need to find a way to reflect and refract from a non-spherical surface, while the existing helper functions can only be used if a dNdP is known.

I hope that someone might be able to point me to more examples out there, or to share their thoughts on how my goal might be achieved.

I’ll also be looking into Tracing Ray Differentials (Igehy, 1999).