Austin Haines CSC 471 Final Project Winter 2015
Ray Tracer
Introduction
Ray tracers utilize an alternate technique for rasterization of 3D images by projecting "rays" down every pixel of the screen.
Upon intersection with an object, the ray tracer records a hit and determines a color for the pixel.
The most basic form of this type of program outputs a "ray cast", which is a flat, orthographic projection of the scene
Sample ray cast from my program:
Shading
In order to add some detail to the scene, a shading method must be employed.
For my program I implemented a Phong lighting model which takes into account ambient, specular, and diffuse qualities along with a shininess variable.
Shadows
Shadow implementation is relatively straightforward in a ray tracing scenario.
The program simply used the same method of projecting rays and detectinging intersection but instead of originating from the camera to some distance down z,
the ray originates at the point on the object and is directed toward the light source.
If an intersection is detected, then the object only recieves the ambient light property, which results in a shadow.
Otherwise the full Phong model is applied.
Reflection
Reflection is calculated in much the same way that shadows are, with rays projected from the intersection point in question.
This time, if an intersection occurs, the color of said intersection is retrieved and applied to the color of the original point.
The strength of these reflections is variablized to allow for more or less reflective surfaces.
Here are several different images showcasing shadows, phong lighting, and reflection:
Compilation
Simply compile the provided .cpp and .h helper files to generate an exe that will generate the first image of the final renders, named awesome.bmp.
References
Tutorial used for reference and bmp writer taken from: https://www.youtube.com/watch?v=k_aRiYSXcyo
http://www.cs.utah.edu/~shirley/books/fcg2/rt.pdf
https://www.cs.uaf.edu/2012/spring/cs481/section/0/lecture/01_26_ray_intersections.html