This project has been created as part of the 42 curriculum by brensant and rgomes-d.
miniRT is a simple ray tracer written in C, developed as part of the 42 School curriculum. The goal of the project is to render a 3D scene described in a text file by simulating the behavior of light rays traveling from a virtual camera into the scene.
The renderer supports geometric primitives such as spheres, planes, and cylinders, along with transformations, multiple light sources, shadows, and the Phong reflection model. The bonus version also includes additional features such as object textures, checkerboard patterns, normal mapping, and other visual effects.
The project was built from scratch using only the allowed libraries and focuses on fundamental computer graphics concepts, including:
- Ray-object intersection algorithms
- Vector and matrix mathematics
- Coordinate space transformations
- Camera projection
- Lighting and shading models
- Shadow ray casting
- Texture mapping
- Surface normal manipulation
The objective of miniRT is not to compete with modern rendering engines, but to provide a practical understanding of the mathematical and computational principles behind ray tracing and image synthesis.
-
Clone the repository:
git clone --recurse-submodules https://github.com/Breno-S/42_miniRT.git
-
Move into the project directory:
cd 42_miniRT -
Compile the project:
make bonus
-
Run the executable passing a scene as an argument:
./miniRT ./scenes/scene1_bonus.rt
Here are some of the most useful resources used to understand and develop this project:
General Computer Graphics and Ray Tracing Concepts
Vector Math
Lighting
- Phong reflection model - Wikipedia
- Learn OpenGL - Basic Lighting
- 9.2 Modelo de reflexão de Phong | MCTA008-17 Computação Gráfica
Tutorials
- Ray tracing from scratch [C++ & SDL2]
- Ray Tracing in One Weekend Series
- Desenvolvendo um Raytracer em C
Important
During the development of this project, AI tools (such as ChatGPT) were used as a learning aid to clarify concepts related to ray tracing and help with some math equations. Also, this README was improved with AI. All architectural decisions, implementations, and debugging were performed by the authors, and no code was copied verbatim from AI-generated sources. The project was developed with the intent of understanding and applying the underlying concepts.