A simple ray tracer implemented in C using MiniLibX. This project simulates light rays to render 3D scenes with basic geometric objects, featuring Phong reflection model and camera controls.
- Supported Objects:
- Sphere
- Plane
- Cylinder
- Circle
- Triangle
- Lighting:
- Ambient lighting
- Diffuse and Specular reflection (Phong model)
- Shadows
- Camera:
- Real-time movement and rotation
- File Parsing:
- Custom
.rtscene file format
- Custom
- GCC or Clang
- MiniLibX dependencies (OpenGL, AppKit on macOS)
- Clone the repository:
git clone https://github.com/haelime/miniRT.git cd miniRT - Build the project:
make
Run the program with a scene file:
./miniRT scenes/sample.rt| Key | Action |
|---|---|
W, S |
Move Forward / Backward |
A, D |
Move Left / Right |
Space, Shift |
Move Up / Down |
↑, ↓, ←, → |
Rotate Camera (X, Y axis) |
Q, E |
Rotate Camera (Z axis) |
R |
Toggle Debug Mode |
ESC |
Exit |
The .rt files define the scene using the following elements:
A(Ambient):ratio [0.0,1.0],color [R,G,B]C(Camera):pos [x,y,z],orientation [x,y,z],FOV [0,180]L(Light):pos [x,y,z],brightness [0.0,1.0],color [R,G,B]sp(Sphere):center [x,y,z],diameter,color [R,G,B]pl(Plane):point [x,y,z],normal [x,y,z],color [R,G,B]cy(Cylinder):center [x,y,z],axis [x,y,z],diameter,height,color [R,G,B]
