CS6620 Advanced Graphics 2 University of Utah
Prof: Peter Shirley Ray Tracing Sem: Spring 2002

Assignment 07 - Glass & Mirrors

On top of the framework I built for Assignment 06 - Image Texture Mapping, I've added the ability to render dielectrics and reflective materials.

In the scene description file, you can now add dielectric and reflective properties to a material, like so:

material "glass" {
 dielectric < 0.6 0.95 0.85 >
 index 1.5
 # vacuum = 1.0
 # air    = 1.003
 # ice    = 1.31
 # water  = 1.33
 # glass  = 1.5

material "mirror" {
 reflectance < 1 1 1 >

The dielectric key specifies the color of the dielectric on total internal reflection (and it also tints the dielectric on refraction). The index key is the index of refraction of the dielectric. The reflectance key specifies how reflective the material is and what color it reflects (set it to all 1.0's for a perfect mirror).

glass-0 glass-40 glass-80
glass-120 glass-160 glass-200
glass-240 glass-280 glass-320
(click on each image for a larger view).

Here are a few frames of a 45 frame animation of a scene with piece of glass and a perfect mirror.

DivX Video (395 Kb)

(There are some pinkish-purple lines that appear toward the end of the animation - these are artifacts of the compression and aren't in the source renderings.)

glassflake mirrorflake
metalteapot glassball
(click on each image for a larger view).

A glass sphereflake, a metal sphereflake, a metal (gold) teapot and a glass ball.

All of the images above can be regenerated by specifying the appropriate scene file on the command line of the rayn program rayn-07.zip (288 Kb). The source code is included in the zip file. Here is a description of the command line parameters for rayn.
usage: rayn [options] <scene_file>


             <scene_file>    file containing scene description


  -o         <output_file>   output image filename (output.tga)
  -w         <width>         width of output image (256)
  -h         <height>        height of output image (256)
  -shadows   <true/false>    generate shadow rays (true)
  -rgs       <true/false>    generate regular grid subdivision (true)
  -bvh       <true/false>    generate bounding volume hierarchy (false)
  -sort      <true/false>    sort (not split) the surface list (false)
  -cull      <true/false>    cull backfacing triangles (false)

Questions/comments to nate@pobox.com.

March 2002
© Nate Robins