Subscribe via feed.

Ray Tracer

This was a small graphics program done with Win32 api.  The program takes in a text document with a list of shapes, lights and a viewpoint.  Shapes include spheres, parallelograms, planes, ellipses, pyramids, and tori.  Each shape also had color, reflective, and opaqueness properties passed to the program.  Each light in the input list was either an omni-directional light or a directed light with a vector indicating direction.  Each light also had a property of how bright it is in the scene.

stest1 atest1

 

This program works by getting the color of each pixel in the drawing window by sending a ray from the viewpoint through the pixel and into the scene.  It goes until it hits an object and, depending on the properties of that object, will reflect off the object or refract through the object.  It does this for a number of bounces, or until it hits a light source.  After analyzing each bounce, the program will return the true color of that pixel to the drawing window.

atest2ctest1