miniRT is a simple ray tracer written in C that can render complex scenes with various shapes and lighting effects.
- Render scenes with planes, spheres, cylinders, and cones.
- Handle all possible intersections between objects correctly.
- Resize object properties such as diameter for spheres and width/height for cylinders.
- Apply translation and rotation transformations to objects, lights, and cameras.
- Light management with spot brightness, hard shadows, and ambiance lighting.
- Ambient, diffuse, and specular lighting using the Phong reflection model.
- Display images in a window with the ability to close cleanly using ESC or the red cross.
- Color disruption with a checkerboard pattern.
- Colored and multi-spot lights.
- Textures for added visual detail.
The program takes a scene description file with the .rt extension as the first argument.
make FAST=1 && ./miniRT scene.rt
The scene description file (.rt) defines the elements of the scene using the following syntax:
A intensity red,green,blue
C PositionX,PositionY,PositionZ OriginX,OriginY,OriginZ fieldOfView
L x,y,z brightness r,g,b
sp x,y,z d r,g,b shininess,diffuse,specular [ch:r,g,b|tx:/path/to/texture/file.png]
pl x,y,z ox,oy,oz r,g,b shininess,diffuse,specular [ch:r,g,b|tx:/path/to/texture/file.png]
cy x,y,z ox,oy,oz d h r,g,b shininess,diffuse,specular [ch:r,g,b|tx:/path/to/texture/file.png]
cn x,y,z ox,oy,oz d h r,g,b shininess,diffuse,specular [ch:r,g,b|tx:/path/to/texture/file.png]
cnh x,y,z ox,oy,oz d h r,g,b shininess,diffuse,specular [ch:r,g,b|tx:/path/to/texture/file.png]
Use #
for single line comments.
# This is a valid comment
A 1 255,255,255 # but this is invalid
# Ambient
A 1 184,232,252
# Camera
C 0,0,-5 0,0,1 50
# Lights
L -10,10,-10 0.7 255,255,255
# Planes
pl 0,-1,0 0,1,0 255,255,255 200,1,0
# Cones
cnh 0,-1,0 0,1,0 1 1.5 255,255,255 200,1,0 tx:textures/waffle.png
# Spheres
sp 0,0.6,0 1 255,255,255 200,1,0 tx:textures/strawberry.png