Portfolio | OpenCL Ray Tracer

(OpenCL) Ray Tracer

An (OpenCL-accelerated) application to render scenes using the method of ray tracing.

Role: Programmer
Responsibilities: Build on top of a bare-bones sample code for a cpu-based ray tracing application.
Purpose: Internship application work sample for CineSite.
Result: I won!


For an internship application to a cinema visual effects company, I was given example projects to work on. One of them was a ray tracer. Since I have past experience with raytracing as well as a great interest on the subject, I have chosen the task to develop the application.

The sample code given to me was in C++, built for the CPU. It produced output as sequences of .tga files. I first added some features to this code such as diffuse and specular colors, reflectivity. Afterwards, I decided to branch the development, one branch for GPU, one for CPU. Visual Studio 2010 allowed me to set variables for the environment to enable/disable parts of the code. I wanted the program to have identical results in both branches therefore I spent some time to get both branches to show the exact same pixels as output. Aftwarwards, for each new feature, I would code it first for the GPU, then write the corresponding piece for the CPU. People without OpenCL drivers can then execute the CPU-only version without problems if they wish.

Stage of development as of now:

The GPU-enabled application can run at framerates above 30 per second (on a AMD Radeon HD 6900 Series GPU), producing the same quality of output as the CPU-only version. Features:

    • Diffuse and specular color
    • Lights of different colors and intensities
    • Spheres, planes, triangles, axis-aligned bounding boxes
    • Animation
    • Reflection, diffraction, transparency, color absorption
    • Glossy reflections
    • Hard shadows