| |
  |
           |  |
| |
 |
|
|
Title: Intermediate Ray Tracer
Author: Nathan Cournia
Description: A simple ray tracer.
Institution: Clemson University
Class: CPSC805 - Advanced Computer Graphics
Language: C++
Construction Time: Many
Date Completed: March 26, 2002
|

A slight upgrade to the my first ray tracer. In addition to various small fixes, here's what was added:
Polygons
Cylinders
Boxes
Soft Shadows (Area Lights)
Inverse Spherical Mapping
Convex Quadrilateral Inverse Mapping
Bump Mapping
Anit-Aliasing
Fully Movable Camera
POVRAY Parser
Light Attenuation
Object Transformations
Animation
Unfortunately, during sping break my hard drive decided to die. I lost most of the images and
animations I had created for this assignment. What you see here is what I had saved on another machine.

I spent a great deal of time reading for this assignment. As a result, not much coding
got done. I tried to fake caustics (by changing the shade of the shadow based on the angle between
the surface normal and the light source) but the results were less than stellar. I eventually decided
to leave caustics to photon mapping. Hopefully I'll get a little more done on the next version
of my ray tracer.
Here are some notes about various aspects of the ray tracer:
Polygons:
Unlike POVRAY, polygons are created using the "quad" keyword in the input file. Polygons must have 4
points. I plan changing this behaviour in the future.
Cylinders:
I wrote the cylinder object about an hour before this project was due (I wasn't feeling motivated). As
a result, I haven't implemented transformations, bump mapping, or texture mapping for cylinders.
Boxes:
Boxes are cool. I had an animation with a slew of refractive boxes rotating around, but it was lost
in the great hard drive crash over sping break.
Soft Shadows:
Soft shadow are implented using spherical area lights. Sampling on the area light is achieved through
the density function described in Shirley. Even with the clever sampling function, creating good looking
soft shadows takes a good deal of time. Here's an example of a scene with and without soft shadows:

Texture Mapping:
Just about anything can be texture mapped.
Bump Mapping:
I had alot of cool images with bump mapping, but they were lost. I'll try to post some later.
Bump mapping works by computing the gradient between pixels in an image map given a u,v coordinate.
I can also control how much the surface normal can be perturbed by the bump_size keyword. Here
are some images showing that bump mapping actually does work and is not a hack (i.e. to images
blended together). The bump_size keyword is also demonstrated.

Anti-Aliasing:
Anti-alising is done by jittering a regular grid. I'll probably change this in the future.
Fully Movable Camera:
The camera works just like in POVRAY. Just specify a location and a look at point.
POVRAY Parser:
I created a POVRAY parser with Yacc and Lex. Only a subset of the POVRAY format is supported. Animation
and the inclusion of other files is also not supported. I also have not implemented error reporting.
Of course, this will change . . .
Light Attenuation:
Specified with "fade_distance" and "fade_power".

Object Transformations:
Since I'm new to computer graphics, this was a cool exercise. While developing this feature I discovered
our friend Gimbal lock! I wrote some quaternion code to fix this but I have yet to integrate it into
the main codebase.

Animation:
Animation is a complete hack. A couple of lines of PERL and I had animation flying at me. I plan on creating
a more graceful animation system in the future. Like I said before, alot of the animations were
lost in my hard drive crash. Here's what survived:

Other:
I have several other things in the works. One being a nice GUI. I've also gathered some
reading material on photon mapping. Hopefully things will turn out nicely.
Compiling:
The code is pretty messy. I haven't had a chance to clean up all of my test code and debugging
statements. shader::shade() is a nightmare and will eventually be cleaned up.
However, compiling the code should be straight forward. Just type:
make
For command line options type:
./yart
Example invocation:
./yart -i hard.pov -w 640 -h 480 -a 16

Source Code: cournia_yart-20020404.tar.gz (270k)
|
|
|






|
|
|
|