Stocaster: Photon Mapping in Realtime

interactive focusing and caustics

Abstract

Raster-based rendering is both common and fast, but it has some significant shortcomings. Most of these problems deal with the handling of light -- e.g. in OpenGL, the best possible lighting is eight point light sources without shadows. This means that commonly seen effects like shadows, area light sources, diffuse reflection, and caustics are not easily accomplished.

Stocaster, a 3d scene graph renderer, couples the real-time performance of OpenGL with the realism of photon-mapping. An OpenGL front-end renders the scene at a smooth frame rate, while textures are regenerated concurrently in the background. Ideally, they run asychronously, so that the performance of one renderer does not significantly affect that of the other.

Basic Algorithm

  Construct scene graph
  For each light source
    Generate a photon in a random direction from source
    Set current ray to photon trajectory
    While photon is alive
      Test scene for intersect with ray
        If intersect found
          Photon is alive
          Store photon hit on object
          Set ray origin to intersect, direction as determined by surface model
        Else
          Photon is dead
  For each object in scene
    Compile photon hits into texture
  Render scene in OpenGL

Implementation

The project consists of a collection of object files that manage a scene graph. It is highly modularized, and it is trivial to add a new shape, shader, etc. No specific scene is coded in, but a demo program that uses the modules is included.

The entire project is coded in pure OO C++, with OpenGL interfaces. The demo program, seen below, uses GLUT to take care of the messy X11 details.

Progress

Currently implemented shapes are spheres and planes. Surface types are specular, diffuse, and refractive. Only a single wavelength is currently used. No textures are created yet-- only photon points.

Sample Output

Sample of results circa early April02. The isolated point at the top is the light source, and its being focussed onto a plane by a blue sphere.
sample of current results

My (distant) goal. I wish it were mine.
example of a nice caustic rendering

Mr. Glitch 2002 John Karp

Valid HTML 4.01!