MiniRT is a 3D rendering engine written in C, using the ray tracing method. The project aims to provide a good balance between short rendering time and good quality renders.
In 3D computer graphics, ray tracing simulates the behavior of light to create realistic digital images. By tracing the paths of light rays through a virtual scene, it produces highly accurate reflections, refractions and shadows.
This project runs entirely on the CPU and is designed specifically for Linux systems.
click to enlarge | |
---|---|
- BVH Tree acceleration (Bounding Volume Hierarchy) for efficient ray-object intersection tests
- Multithreaded rendering for faster image computation
- SIMD optimizations for faster vector math and BVH navigation
- Cache optimization for improved memory access patterns
- Real-Time rendering (continuous updates on camera movement)
- Anti-Aliasing for smoother edges
- Trimesh object support (.obj file loading)
- Switchable Camera Modes (orbit or static mode)
- Mouse & Keyboard controls to move and rotate the camera
- Pure CPU-based calculations, no GPU acceleration
- Supports planes, spheres, cylinders, rectangles, and triangles
Key | Action |
---|---|
q or ESC |
Quit the program |
w |
Move camera forward |
s |
Move camera backward |
a |
Move camera left |
d |
Move camera right |
z |
Zoom in |
x |
Zoom out |
i |
Rotate camera up |
k |
Rotate camera down |
j |
Rotate camera left |
l |
Rotate camera right |
u |
Roll camera left |
o |
Roll camera right |
c |
Toggle camera mode (orbit vs. static) |
m |
Enable anti-aliasing |
Button | Action |
---|---|
Left click + drag | Translate camera |
Right click + drag | Rotate camera |
Scroll up | Zoom in |
Scroll down | Zoom out |
# Clone the repository
git clone https://github.com/maricalmer/miniRT.git minirt
cd minirt
# Build the project
make
# Run scene
./miniRT assets/scenes/100k_happy.rt
Strict coding guidelines for the 42 School curriculum. Here is a concise summary of the most important aspects of this coding style:
- Files: Max 5 functions per file; lines ≤ 80 chars.
- Functions: Max 25 lines; max 4 parameters
- Naming: snake_case
- Control Flow: Only if, else, and while allowed; ❌ No for, switch, ternary (?:), or do...while ❌
- Variables: Declared only at the start of functions; no VLAs
- Macros: Only for constants; no function-like macros
- (...)
- Write more tests
- Add portability for main platforms