A Raytracer built from scratch in C using MiniLibX, a minimal graphics library restricted to single pixel manipulation. This engine renders computer-generated images by tracing the path of light rays through pixels in an image plane and simulating the effects of its encounters with virtual objects.
- Primitives: Sphere, Plane, Cylinder, Hyperbolic Paraboloid.
- Lighting:
- Ambient lighting.
- Diffuse shading.
- Hard shadows.
- Multiple light sources.
- Colored lights support.
- Phong reflection model (Specular highlights).
- Camera: Moveable camera with FOV control.
- System:
- BMP export capability.
- Clean memory management.
Before building on Linux (or WSL), install the MiniLibX dependencies:
sudo apt-get update
sudo apt-get install xorg libxext-dev zlib1g-dev libbsd-devmake./miniRT scenes/galaxy.rtRender scene without opening window and save to BMP:
./miniRT scenes/galaxy.rt --saveTo render all scenes present in scenes/ automatically:
python3 render_all.pyscenes/: Contains all.rtscene description files.results/: Rendered images.srcs/: Source code.includes/: Header files.
Interact with the scene at runtime using the mouse and terminal.
| Input | Action |
|---|---|
| Left Click | Select an object to view its properties. Click background for Scene info. |
| Q | Unselect current object. |
| C | Edit Mode. Modify the currently selected item via terminal. |
| ESC | Close program. |
After pressing C, look at your terminal:
- Modify: Type new values when prompted to update coordinates or properties.
- Delete Object: Press
ENTER(input nothing) for every prompt when editing an object. - Scene Editing: If no object is selected, you can modify Camera and Lights.
Scenes are defined in .rt files:
| Identifier | Description | Parameters |
|---|---|---|
| A | Ambient Light | ratio R,G,B |
| C | Camera | x,y,z vec_x,vec_y,vec_z FOV |
| L | Light | x,y,z brightness R,G,B |
| sp | Sphere | x,y,z diameter R,G,B |
| pl | Plane | x,y,z norm_x,norm_y,norm_z R,G,B |
| cy | Cylinder | x,y,z norm_x,norm_y,norm_z diameter height R,G,B |
| h_p | Hyperbolic Paraboloid | parameters(A,B,C,D,E,F,G) size R,G,B |





