This project has been created as part of the 42 curriculum by Shimi-be and Carlopez.
MiniRT is a fundamental computer graphics project designed to learn about Ray Tracing. Written entirely in C, this application simulates how rays of light interact with geometric objects in a virtual 3D space.
The aim of this project is to create a 3D picture by following the path of light from your eyes to every dot on the screen. Our program calculates what happens when light hits digital shapes, allowing us to show realistic effects such us :
- Ambient Lighting: Global illumination to ensure nothing is completely black.
- Diffuse Reflection: Soft shading based on the angle of light.
- Specular Highlights: Glossy reflections.
- Shadows: Areas where an object blocks the light.
- Checkerboard Textures: Patterned floors.
The project includes a Makefile with the standard rules. To compile the program, run :
makeTo launch the renderer, you must provide a scene description file with the .rt extension :
./miniRT test_files/a.rtThe configuration files can allow you to define :
- A (Ambient) : Global light intensity and color.
- C (Camera) : Position, orientation vector and FOV.
- L (Light) : Position, brightness and rgb color.
- sp (Sphere), pl (Plane), cy (Cylinder) : Position, dimensions and colors.
To build this project, we relied on a mix of formal and community-driven knowledge:
- Wikipedia : Our primary source for fundamental mathematical formulas. It provided the necessary equations for ray-object intersections.
- University Lectures : We consulted open-source materials from various University Computer Science Departments. These provided deeper explanations of the physics behind the formulas, helping us understand why the math works, not just how to copy it.
- 42 Peer Repositories : We analyzed the work of other 42 students on GitHub. This was crucial for deciding on an efficient project structure.
An AI collaborator was used to solve specific technical challenges that were not easily found in standard documentation:
- Gimbal Lock Correction : Assisted in diagnosing and fixing the camera failure that occurs when looking directly up or down.
- Custom Scene Testing : Created specific
.rtfile configurations to test shadows and textures. - Documentation Support : Provided assistance in translating technical concepts into professional English for this README.
To verify the engine's requirements, we have run multiple scene configurations, this is an example :
Purpose: Validates ambient/diffuse shading and shadow occlusion.
- Scene: A sphere on a plane with a single light source.
- What to look for: Smooth transitions from light to dark on the spheres and clear, accurate shadows cast on the floor.
A 0.2 255,255,255
C 0,0,-5 0,0,1 70
L 5,5,0 0.8 255,255,255
sp 0,0,10 6 255,255,255
pl 0,-3,0 0,1,0 255,255,255

