Raytracer

Scroll down for some cool images!

Development:

The Raytracer described on this page was developed by Brendan Rafeld (bjrafeld@gmail.com) and myself in March 2013. It was written entirely from scratch in C++ and uses OpenGL graphics for the actual drawing. We do not want to make our code public, but I’d be happy to share more detailed information about our implementation via email.

For those unfamiliar with a Raytracer, you can check out the wikipedia page here: http://en.wikipedia.org/wiki/Raytracer
In essence, a raytracer can generate images by shooting a ray through each pixel of the screen and calculating the color of that pixel based on what objects that ray hits and the shading that results. It is an extremely computation-heavy process, but as you can see below a raytracer can produce images with incredible levels of detailed lighting and reflection, something which would not be possible to compute in real-time.

Each image is based off of user input that describes a scene composed of a number of shapes and lights. The shapes are either spheres or triangles that are placed in the room and can then be transformed in some way. The lights are point or directional lights that are positioned in the scene and set to a certain direction and color. These objects are described as user input and given to the raytracer program, which then parses input, generates the appropriate scene and computes the correct image using the raytracer algorithm.

For shading, we implemented the Phong Shading Model (more info can be found here: http://en.wikipedia.org/wiki/Phong_shading). As we illustrate in the images below, this includes the ability to enable and disable the ambient, diffuse and specular for particular images to produce more interesting effects.

Images
The following are images that we rendered with our program.

This picture is rendered with a reflection depth of 10, that is, the program allows rays to bounce off of objects up to 10 times in order to calculate shading.
image-14

This is the same scene as the image above but with a reflection depth of 0.
image-15

Another scene with reflection.
image-13

This is an example of a scene rendered solely with ambient lighting.
image-10

This is the same scene as above, but with only diffuse shading being calculated.
image-11

This is also the same scene as above, but purely with specular lighting.
image-12

Lastly, we have the same scene with ambient, diffuse and specular lighting (ie, the Phong Shading Model)
image-8

We’re hoping to make more cool images with our program in the future! For any additional information about this program, just contact me at douglas.wreden@gmail.com.

Leave a comment