Ray Tracer

Render 3D Objects With Light Rays

Spring 2013


What Is It?

Ray Tracing is a technique in computer graphics used to simulate the paths of light to create a realistic rendering of a 3D scene. This is the 4th project of Carnegie Mellon's Computer Graphics course (15-462) and is written within 2 weeks.


In all the images you see on this page, the ones on the left are the default 3D scenes, and the images on the right are what those scenes look like after my raytracer is ran on them.



Raytrace of the famous "Cornell Box" scene

What Is It Written In?

The ray tracer is written in C++ using the OpenGL.



This demonstrates shadow ray casting

What Is the Algorithm?

The camera shoots out many simulated light rays into the scene, which then bounce recursively off of the surfaces to record the surrounding areas. The combined color of the environment and the surface determines the return value of a single light ray, which is then used as the color of a single pixel. This same algorithm is then applied to every single pixel.



Reflections from raytraced spheres

What Did I Learn?

Besides how to ray trace (obviously), I learned modularization of my program, application of vector math, management of large amounts of data, and creation of safely multithreaded code.