miniRT is a basic ray-tracer that renders 3D scenes described in a simple .rt file format. It supports a variety of geometric shapes, flexible lighting, material shading with bump mapping, and interactive camera controls. The project uses custom vector and matrix math libraries, multithreaded rendering, and optimized intersection routines for performance. Ray tracing is a fundamental technique in computer graphics for producing highly realistic images by simulating light paths, and it is computationally intensive and mathematically challenging.
- Geometry: renders planes, rectangles, spheres, cylinders, and cones.
- Lighting & shading: ambient, diffuse, and specular lighting with control over shininess. Shadows from multiple light sources.
- Bump mapping: support for texture files (
.xpm) on surfaces (walls, pillars, objects) viabump=option in.rt. - Multiple lights & cameras: scene may include more than one light source and more than one camera.
- Camera controls: interactive — rotate, translate (move), zoom, and switch among multiple cameras. Mouse + keyboard supported. Escape (Esc) to exit.
- Custom math/optimization: vector and matrix operations implemented from scratch; intersection routines optimized; rendering uses thread pools for parallelism.
Here is an example of what a .rt scene file can look like:
A 0.3 25,25,25
c 0,50,300 0,0,-1 70
pl 70,50,30 -1,0,0 25,25,25 bump=scenes/corridor/wall.xpm
sp -70,0,160 50 160,160,160 bump=scenes/corridor/pillar_base.xpm
cy -70,0,160 0,1,0 40 100 160,160,160 bump=scenes/corridor/pillar.xpm
co 0,110,70 0,-1,0 25 20 100,100,100
co 0,110,-70 0,-1,0 25 20 100,100,100
l 0,85,-910 0.3 127,127,127
l 0,85,-1050 0.3 127,127,127- A: ambient lighting — intensity and color.
- c: camera — position, orientation vector, and field-of-view angle.
- pl: plane (or rectangle) — position, normal vector, color, optional bump/texture.
- sp: sphere — center, diameter (or radius depending on your implementation), color, optional bump/texture.
- cy: cylinder — base center, orientation vector, radius, height, color, optional bump/texture.
- co: cone — apex position, orientation vector, base radius, height, color.
- l: light — position, brightness, and color.
- Translate object: Left-click on an object, then use W, A, S, D, Q, E to move it.
- Rotate object: Right-click on an object, then use W, A, S, D, Q, E to rotate it.
- Resize object: Left-click on an object, then use the scroll wheel to scale it.
- Adjust shininess: Left-click on an object, then press - or + to decrease or increase its shininess.
- Move main light source: Use I, J, K, L, U, O to translate the primary light.
- Rotate camera: Middle-click anywhere, then use W, A, S, D, Q, E to rotate.
- Translate camera: Press C, then use W, A, S, D, Q, E to move the camera.
- Change FOV: Right-click anywhere and use the scroll wheel to zoom in/out.
- Switch between cameras: Press 0, 1, 2... to select an available camera.
- Custom vector and matrix math library (no external dependencies) — used for all geometric computations
- Intersection calculations for all supported shapes implemented manually
- Lighting model: ambient + diffuse + specular shading with shininess factor
- Shadows computed per-light source for realistic shading
- Bump mapping / texture mapping support using
.xpmtextures - Multithreaded rendering using a thread pool for increasing performance
- Write or use a
.rtscene file following the supported format. - Build the project (e.g.
make). - Run the program with the path to
.rtfile as argument. - Use mouse & keyboard to navigate or manipulate the camera and view the scene.
- Press Esc to exit.



