Ray Tracer

A ray tracer written from scratch in C with no external libraries.

2023 · CSCI 5607 Fundamentals of Computer Graphics, University of Minnesota

The Stanford dragon, 500k triangles, rendered through the BVH in roughly ten seconds.
The Stanford dragon, 500k triangles, rendered through the BVH in roughly ten seconds.

A CPU ray tracer I wrote in C over one semester, with no external dependencies. I wrote my own dynamic array, hash map, lexer, and scene file parser. Each assignment added a feature, starting with Perlin noise images and adding camera projection, Phong shading, texture mapping, triangle meshes, reflection, and refraction. A bounding volume hierarchy (BVH) splits each node at the midpoint of its longest axis. With it, the tracer renders the half-million-triangle Stanford dragon in about ten seconds.

My role

Sole author.

Media

The dragon against a procedural checkerboard.
The dragon against a procedural checkerboard.
Alternate lighting on the dragon scene.
Alternate lighting on the dragon scene.
Stanford bunny with texture mapping on a textured sphere.
Stanford bunny with texture mapping on a textured sphere.
Light refracting through a glass sphere.
Light refracting through a glass sphere.
Light reflecting between spheres.
Light reflecting between spheres.
Refraction through the bunny mesh.
Refraction through the bunny mesh.
Phong shading and shadows across a sphere scene.
Phong shading and shadows across a sphere scene.
Texture-mapping showcase render.
Texture-mapping showcase render.
Camera projection study with field of view and up-vector experiments.
Camera projection study with field of view and up-vector experiments.
A textured scene with wood siding, a shingled roof, and grass, all from texture-mapped geometry.
A textured scene with wood siding, a shingled roof, and grass, all from texture-mapped geometry.
The dragon against the checkerboard, before the shading pass.
The dragon against the checkerboard, before the shading pass.
A procedural pattern generated by the noise functions.
A procedural pattern generated by the noise functions.
Shading study of a sphere and its shadow under varying light.
Shading study of a sphere and its shadow under varying light.
Shading study of the same scene with different material parameters.
Shading study of the same scene with different material parameters.
Camera study with field of view and up-vector experiments from the writeup.
Camera study with field of view and up-vector experiments from the writeup.
Camera study showing the effect of widening the field of view.
Camera study showing the effect of widening the field of view.
Perlin noise image generation from the first assignment.
Perlin noise image generation from the first assignment.

Documents