Raytracer

Class Instructor Date Language Ta'ed Code
CS 3451 Intro To Graphics Greg Turk Spring 2012 (Expanded substantially as Personal Project) Java/Processing No Code N/A
CS 7490 Advanced Image Synthesis Greg Turk Spring 2016 Java/Processing No Github Repo

My ray tracer implementation also started as an assignment in a class I took, the undergraduate Computer Graphics course at Tech, and included the usual functionality from a Whitted-style ray tracer, such as shadow rays, reflection, spheres, triangle polygons, and point lights. I figured out and implemented many functions beyond the scope of the assigment, including :


Refraction (based on Fresnel Equations)
Cylinders
Generalized Guadric Surfaces (defined by 10 coefficients)
Quads and Meshes of Triangles or Quads
Texture Mapping on the outside and inside of surfaces/meshes.
Using Inverted Transformation Matrices to direct rays for each object (so a file with OpenGL style transformations mapping objects in space can be easily rendered)
Anti-Aliasing

In Spring Semester 2016 I took Greg Turk's Advanced Image Synthesis class, and expanded my ray tracer to include the following :
Distribution Ray Tracing
Area Lights
Depth of Field effects
Motion Blur
Fisheye Lens
Orthographic Projection
Spotlights (shadows are soft at edges)
Iterative Refinement (render only some evenly-spaced fraction of pixels as large tiles, and then iteratively get finer resolution until every pixel is displayed)
Acceleration via Bounding Volume Hierarchies
Perlin-noise and Worley-noise based Textures
Photon Mapping

I first became aware of ray tracers in the late 80's, when I was a student "the first time", and I've always been fascinated by them, so given the opportunity to actually implement one, I was very motivated, and still love working on it. High on my list of ideal jobs would be working in some capacity with ray tracers.

Image Results from my ray tracer (click for (some) larger images). All scenes layed out via transformation matrices.
  • Texture mapped planets and translucent spheres and cylinders within a texture mapped sphere for a background.
  • Orthographic view of the same scene
  • More spheres
BVH Acceleration structure

By using a Bounding Volume Hierarchy on the following images, along with instancing of the single bunny mesh, I was able to render thousands of complex high-poly count meshes in less than a minute. The Sierpinski tetrahedron of bunnies has 9 layers, giving over 20,000 instances of the 69k poly bunny (many of which are vanishingly small).

  • Translucent and Noise-textured 69k poly bunny meshes with planets.
  • Blue and Red Translucent 69k poly bunnies
  • Thousands of Sierpinski 69k poly bunnies
Perlin and Worley Noise based textured bunnies

  • Perlin Wood 69k poly bunny
  • Perlin Marble 69k poly bunny
  • Worley Crackle-plaster 69k poly bunny
  • Alternate Perlin Pinewood derby 69k poly bunny
  • Alternate Perlin Marble 69k poly bunny
  • Worley Euclidean Distance Alternating Inverse-linear ROI calculation 69k poly bunny
Worley Cellular Noise based textured spheres.

These spheres show the effects of varying different parameters of the Worley noise algorithm. These parameters are noise scale (describing the size of the blobs), distance function used to determine neighborhood (currently either Manhattan (L1) or Euclidean (L2)), Region of Interest function (how distance values are accumulated within neighborhood, currently either the sum, the alternating sum, or the inverse alternating sum of the values, the exponentials of the values or the logs of the values), the number of points in the neighborhood, the average # of random points in each cell and the distance threshold used by the 'mortar' (the grey color - everything below this threshold is gray). A lot of variety is possibly by just varying these values a little bit, as is shown below. I imagine a cool animation could be generated, comparable to Reaction-Diffusion, by varying these parameters incrementally over time as frames are generated.

  • Noise Scale:4 DIST:Euc ROI:Alternating Exponential #Pts Used for ROI:4 Avg # Pts Per Cell:4 Mortar Dist:0.1
  • Noise Scale:4 DIST:Euc ROI:Alternating Inverse Linear #Pts Used for ROI:2 Avg # Pts Per Cell:1 Mortar Dist:0.2
  • Noise Scale:4 DIST:Euc ROI:Alternating Exponential #Pts Used for ROI:4 Avg # Pts Per Cell:6 Mortar Dist:0.17
  • Noise Scale:4 DIST:Euc ROI:Alternating Log #Pts Used for ROI:6 Avg # Pts Per Cell:1 Mortar Dist:0.13
  • Noise Scale:4 DIST:Euc ROI:Exponential #Pts Used for ROI:1 Avg # Pts Per Cell:8 Mortar Dist:0.2
  • Noise Scale:8 DIST:Euc ROI:Log #Pts Used for ROI:2 Avg # Pts Per Cell:4 Mortar Dist:0.6
  • Noise Scale:10 DIST:Euc ROI:Inverse Exponential #Pts Used for ROI:8 Avg # Pts Per Cell:8 Mortar Dist:0.004
  • Noise Scale:4 DIST:Euc ROI:Inverse Log #Pts Used for ROI:2 Avg # Pts Per Cell:1 Mortar Dist:0.23
  • Noise Scale:8 DIST:Man ROI:Linear #Pts Used for ROI:4 Avg # Pts Per Cell:4 Mortar Dist:0.26
Photon Mapping with Caustic and "Diffuse" Photons.

This was the last project for cs7490, and originally we were to implement the final gather step along with the caustic and diffuse photon casting, but this requirement was removed from the assignment due to time concerns. I implemented it on my own.

  • Cornell Box 1 - Photon Mapping without final gather step
  • Cornell Box 2 - Photon Mapping without final gather step
  • Cornell Box 3 - Photon Mapping without final gather step
Motion Blur and Depth of Field effects.
  • 3 moving spheres
  • Depth of field effect
  • Disk Light

  • Scene of 4 shiny balls, 60 degree FOV
  • Same Scene with 360 degreee fisheye lens
  • Blue glass ball - note faint reflection of red triangle behind viewer
  • Cube built of tris
  • 3 concentric cubes
  • Stacked rings of spheres
  • Icosahedron
  • Icosahedron in a sphere
  • Spotlight on a sphere