Part of computer graphics is the interaction of objects into the world/scene you create. In this project I’ve created a raytracer, which allows the objects to reflect light according the materials they’re made of.


This project was part of the Computer Graphics Course provided by UC San Diego through edx.


In computer graphics, ray tracing is a technique in which each pixel is trespassed by 1 or more rays, according to the objects it passes by, it calculates the color to be shown in the pixel taking into consideration their material and the light source.

Ray tracing technique diagram

Ray tracing technique

Apart from color calculation, this project includes a simple 3D matrix/vector calculations used to create the movements (transport, rotation, scale), which were needed to create the scene using a .txt file. Each file contains information about the light color, object material and its respective position in the world.

It was created in C++, using FreeImage to create the png files.

Ray tracing technique using ambient

Using ambient

Ray tracing technique using diffuse

Using diffuse

Ray tracing technique using emission

Using emission

Ray tracing technique using specular

Using specular

Thousand spheres reflecting each other

Thousands spheres

Cornell box

Cornell Box

Red dragon

Red dragon

How to use it?

  1. Go to the downloads section and click the release option.
  2. Open a command prompt and execute the exe followed by a scene inside the scenes folder. Example: Raytracer.exe scenes\scene5.test
  3. Wait! Depending on the scene it might take some minutes to complete.


  1. Release
  2. Source Code
comments powered by Disqus