Skip to content
Ethan CharpentierPortfolio

2025

Raytracer

A C++ CPU raytracer generating photorealistic images from a scene description file — full primitive set, lighting, materials, plugin architecture, and path tracing.

Role
Developer
Tags
graphic, C++, raytracing, system-programming, 2year
Team
  • Tom Gatin — Developer
  • Ewan Crazny — Developer
  • Matthieu Coraleau — Developer
Raytracer — hero image

A CPU-side raytracer built from scratch in C++: read a scene description file, simulate the inverse path of light through it, and output a rendered image — no rasterization pipeline, no engine, just the math of rays, intersections, and light. Pushed past the mandatory feature set all the way to path tracing and global illumination.

The problem

Turning a scene file into a photorealistic image means solving several independent problems at once: parsing an arbitrary scene format into primitives, transformations, lights, and a camera; computing accurate ray-primitive intersections for each pixel; shading each hit point correctly under ambient and directional light; and doing all of this through an architecture open enough that new primitives or lights can be added without touching the core render loop. The renderer also had to stay decoupled from any one shading model or primitive type, using interfaces and at least two design patterns to keep it extensible rather than a monolith of special cases. Going further, achieving true photorealism through global illumination meant leaving direct lighting behind entirely for a full Monte Carlo path-tracing approach.

What We did

  • Built the core ray-tracing loop: for every pixel, cast a ray from the camera through the scene, find the nearest intersection among primitives, and shade the hit point based on the active lights and material.
  • Implemented the full primitive set — spheres, planes, cylinders, and cones — behind a common interface, along with translation and rotation transforms, so new primitive types could be added without changing the renderer itself.
  • Implemented ambient, directional, and drop-shadow lighting with flat-color materials, completing every mandatory and recommended lighting feature.
  • Went beyond direct lighting to implement path tracing: recursive ray bouncing with Monte Carlo sampling to simulate global illumination, indirect light, and soft shadows for genuinely photorealistic renders — the "true raytracer" tier of the project.
  • Parsed scene configuration files (camera setup, primitive lists, lighting) using libconfig++, translating the declarative scene description into the engine's internal object graph.
  • Applied at least two design patterns (Factory for primitive/light instantiation, Composite for scene graph structure) to keep the codebase extensible and defensible during review.
  • Output final renders as PPM files, with a Makefile providing the standard core, re, clean, and fclean build rules.

Outcome

A complete CPU raytracer covering the entire mandatory and recommended feature set, then taken further into path tracing and global illumination — turning a plain-text scene description into genuinely photorealistic renders computed ray by ray, bounce by bounce.

  • Raytracer — gallery image 1
  • Raytracer — gallery image 2
  • Raytracer — gallery image 3
  • Raytracer — gallery image 4
  • Raytracer — gallery image 5
  • Raytracer — gallery image 6
  • Raytracer — gallery image 7
  • Raytracer — gallery image 8
  • Raytracer — gallery image 9
  • Raytracer — gallery image 10
  • Raytracer — gallery image 11
  • Raytracer — gallery image 12
  • Raytracer — gallery image 13
  • Raytracer — gallery image 14
  • Raytracer — gallery image 15
  • Raytracer — gallery image 16
  • Raytracer — gallery image 17
  • Raytracer — gallery image 18
  • Raytracer — gallery image 19
  • Raytracer — gallery image 20
  • Raytracer — gallery image 21
  • Raytracer — gallery image 22
  • Raytracer — gallery image 23
  • Raytracer — gallery image 24
  • Raytracer — gallery image 25