figure 1. images from various applications built with optiX. Top: Physically based light transport through path tracing. Bottom: Ray tracing of
a procedural Julia set, photon mapping, large-scale line of sight and collision detection, Whitted-style ray tracing of dynamic geometry, and
ray traced ambient occlusion. all applications are interactive.
figure 2. a call graph showing the control flow through the ray
tracing pipeline. the yellow boxes represent user-specified programs
and the blue boxes are algorithms internal to optiX. execution is
initiated by the aPi call rtContextLaunch. a built-in function, rt Trace,
can be employed by the ray generation program to cast rays into the
scene. this function may also be called recursively by the closest-hit
program for shadow and secondary rays. the exception program is
executed when the execution of a particular ray is terminated by an
error such as excessive memory consumption.
using the built-in function rt TerminateRay, which will stop
all traversal and unwind the call stack to the most recent
invocation of rt Trace. This is a lightweight exception mechanism that can be used to implement early ray termination for shadow rays and ambient occlusion. Alternatively,
the any-hit program may ignore the intersection using
rtIgnoreIntersection, allowing traversal to continue looking
for other geometric objects. For instance, a program may
choose to ignore an interaction based on a texture channel
lookup to implement efficient alpha-mapped transparency
without restarting traversal. Another use case for the any-hit
program can be found in Section 6. 1, where the application
performs visibility attenuation for partial shadows cast by
glass objects. Note that intersections may be presented out
of order. The default any-hit program is a no-op, which is
often the desired operation.
Miss programs are executed when the ray does not intersect any geometry in the interval provided. They can be
used to implement a background color or environment
Exception programs are executed when the system encounters an exceptional condition, for example, when the recursion stack exceeds the amount of memory available for each
thread, or when a buffer access index is out of range. OptiX also
supports user-defined exceptions that can be thrown from any
program. The exception program can react, for example, by
printing diagnostic messages or visualizing the condition by
writing special color values to an output pixel buffer.
Selector visit programs expose programmability for
coarse-level node graph traversal. For example, an application may choose to vary the level of geometric detail for parts
of the scene on a per-ray basis.
3. 2 Scene representation
An explicit goal of OptiX was to minimize the overhead of
scene representation, rather than forcing a heavyweight
scene graph onto users. The OptiX engine employs a simple
but flexible structure for representing scene information
and associated programmable operations, collected in a
container object called the context. This representation is
also the mechanism for binding programmable shaders to
the object-specific data that they require.