Raytracer
About this project
Apr 2026 – May 2026 · BVH, camera maths, live preview and docs · team of 3 · last push 2026-05-21
A C++ raytracer where everything (shapes, materials, lights, output) is a plugin, sped up with a BVH, with a live preview window.





A raytracer draws a picture the way light works, backwards: it fires a ray through every pixel and follows it around a 3D scene. What does it hit, how is that surface lit, does it reflect? This one was built as a team for Epitech, around one rule: adding something new should never mean changing the engine.
How it works
Everything is a plug-in: shapes, materials, lights, even the way the picture is saved. A scene is a small text file, and adding a new kind of shape means writing one plug-in and naming it in a scene.
To keep big scenes fast, objects are grouped into nested boxes, so a ray that misses a box skips everything inside it. The heat map in the pictures shows it at work. A live window can also show the picture while it is being drawn.
A scene is read from a file like this one, which draws the first picture (download it). Shapes are placed and tilted by their own points and axes; the camera is the one thing that takes a full transform (position, rotation, scale).
camera:
{
resolution = { width = 1280; height = 720; };
position = { x = 0.0; y = -95.0; z = 22.0; };
rotation = { x = 98.0; y = 0.0; z = 0.0; }; # degrees, applied X then Y then Z
fieldOfView = 60.0;
};
primitives:
{
cones = (
# Apex up, axis pointing down: a finite cone standing on the floor
{ apex = { x = 32.0; y = 38.0; z = 24.0; }; axis = { x = 0.0; y = 0.0; z = -1.0; };
radius = 10.0; height = 24.0; color = { r = 245.0; g = 190.0; b = 60.0; }; material = "lambertian"; }
);
# spheres, cylinders and planes follow the same pattern
};
lights:
{
ambient = { multiplier = 0.25; color = { r = 255.0; g = 255.0; b = 255.0; }; };
point = (
{ position = { x = -60.0; y = -40.0; z = 90.0; }; color = { r = 255.0; g = 245.0; b = 230.0; }; intensity = 0.8; }
);
};
The documentation is generated from the code and published automatically, and the repository ships 23 sample scenes, from a billiard table to a rainbow corridor.
What I took from it
- A clear boundary pays off once everyone respects it: new features arrive as new files instead of edits to the core.
- The best speed-ups come from not doing work at all, here by skipping whole parts of the scene.