Path tracing is a straightforward technique for rendering physically correct computer generated images. In 2011 I completed the first version of Final Stage, but later decided to refresh the project with some additional rendering features, as well as remove features that hindered cross platform support. The result is a simple cross-platform path tracer that demonstrates several classic rendering techniques.



Features

This rendering engine supports the following features:

  1. Physically based rendering using an unbiased simulation of light transport that incorporates both surface and subsurface interactions with materials.

  2. Optimized scene traversal using octrees with leaf-neighbor traversal to improve scene collision work by up to 100x over naive approaches. For more information, check out this lecture.

  3. Fullscreen antialiasing using multiple rays per pixel to improve overall scene quality. Supports an arbitrary number of multi-rays, with a default of 4.

  4. Variance adaptive image denoising that removes noise produced by the Monte Carlo path sampling process. Improves final output equivalent to a 300% increase in ray samples. For more information about this process, check out this lecture.

  5. Full 128 bit color pipeline with support for high dynamic textures and effects.

  6. Micro importance sampling to improve convergence time by focusing rays where it matters most.

  7. Configurable image plane effects designed to increase realism and stylistic control, including depth of field, flare, and bloom.

  8. Configurable material library that supports standard properties for describing surface/light interactions, including ambient, diffuse, and emissive terms, solid angle thresholds, and subsurface density. Also includes a higher level layer of intuitive predefined materials including liquid, glass, ceramic, metal, clay, mirror, and fog.

  9. Simple scene descriptions using Wavefront object (.obj) files, Microsoft bitmap (.bmp) files, and HDRsoft's high dynamic range image (.hdr) files, as well as native primitive shapes including sphere, plane, and cuboid.

  10. Multithreading support using C++11 threads.



Materials

Final Stage includes a set of pre-configured and adjustable materials that cover a wide range of material types. Material classes are named using intuitive material descriptions. The following screenshots show a partial list of the materials available.

Clay: fully diffuse reflection

Ceramic: diffuse + specular

Metallic: constrained reflection

Glass: reflection + refraction

Plastic: transmission

Liquid: refraction + reflection

Mirror: prefectly reflective

Magical: emissive + ceramic

Screenshots

The following screenshots were generated with 2k primary samples per pixel. Although heavily scene dependent, Final Stage maintained between 1 and 15 million rays per second on 2016 hardware.



Videos



Removal of GPU Rendering

Final Stage 1.0 supported NVIDIA's CUDA for GPU based path tracing. This worked quite well and I was happy with the improved performance, but it also severely limited cross platform support. For version 2.0 I was hoping to drop CUDA in favor of a more cross platform solution, but there simply doesn't appear to be a viable alternative at the moment.

OpenCL initially seemed like a promising alternative, but its platform support appears to be waning, I'm not terribly fond of its API, and a basic port of Final Stage suggests that more fundamental engine changes would be necessary to achieve decent performance. DirectCompute, Metal, Vulkan, Mantle (etc.) are also interesting, but also appear to be limited in platform support.

As such, I decided to rip out GPU rendering support and instead focus on a fully cross platform CPU-only solution. This incurs a significant performance cost, but I really like being able to tweak projects years later without the hassle of finding the right hardware/drivers/SDKs!

Downloads

  Final Stage 2.0 Demo for Windows (128 KB)
  Final Stage 2.0 Source Code


Final Stage supports a custom scene file format that supports materials, meshes, spheres, cuboids, quads, skies, and cameras. Download demo scenes from the links below. For installation, extract the archives into the folder that contains Final Stage, and run the app with the scene file using the -f command line flag.

The demo supports two simple controls: left mouse click + drag will reorient the camera around the target point (specified in the scene file), while right mouse click will update the camera's depth of focus if the camera has a non-zero aperture.