3D ray tracer built in C with multi-threading support for parallel rendering.
- Ray Tracing Engine: Renders 3D scenes by casting rays from camera through pixels
- Multi-Threading: Added pthread support to render different image rows in parallel
- Multiple Shapes: Spheres, planes, cylinders, cones, triangles
- Phong Lighting: Ambient, diffuse, and specular lighting with shadows
- Reflections: Recursive ray casting for reflective surfaces
Here are some examples of scenes rendered with miniRT:
A more complex model, showcasing triangle mesh rendering.
The Cornell Box, a standard test for ray tracers.
A scene demonstrating all supported geometric primitives.
A colorful scene with multiple spheres and reflections.
A planetary scene with lighting and shadows.
An abstract representation of an atom.
A room scene with a bright light source.
The same room scene with a dimmer, more atmospheric lighting.
A majestic dragon, showcasing complex model rendering.
- GCC or Clang compiler
- GNU Make
- X11 development libraries (Linux)
- MLX library
git clone --recursive [email protected]:tham-le/miniRT.git
cd miniRT
make// Multi-threaded rendering structure
typedef struct s_thread_data {
t_data *data;
int start_row;
int end_row;
int thread_id;
} t_thread_data;
// Optimized vector normalization
void fast_normalize_vec(t_vector *vec) {
double mag_sq = vec_magnitude_squared(vec);
if (mag_sq == 0) return;
double inv_mag = 1.0 / sqrt(mag_sq);
scale_vec(vec, vec, inv_mag);
}./miniRT scenes/one_sphere.rtA 0.2 255,255,255 # Ambient lighting
C 0,0,-5 0,0,1 70 # Camera
L -40,50,0 0.8 255,255,255 # Light
sp 0,0,0 2 255,0,0 # Sphere
- C Programming (8,000+ lines)
- Multi-threading (pthreads)
- 3D Mathematics (vectors, matrices, ray-object intersections)
- Graphics Programming (ray tracing algorithms)
- Memory Management (efficient data structures)
