/miniRT

Primary LanguageCGNU General Public License v3.0GPL-3.0

miniRT

42 Ciriculum project MiniRT stands for "Mini Ray-Tracer", which is a program that creates an image by mathemnaticaly simulating rays of light going through every pixel using MLX graphic library. (Grade 125/100)

This technic alows to render realistic looking pictures. This program can generate regular Phong model difusion, recursive reflection AND refraction, calculating multi spot and colored lights, custom skydomes, regular and bump textures. All of this with objects like Sphere, Plane, Cylinder, Triangle and Hyperboloid And here are some examples :

Examples

Screen Shot 2023-01-27 at 7 40 44 PM

Screen Shot 2023-01-27 at 7 53 45 PM

Screen Shot 2023-01-30 at 3 46 43 PM

Screen Shot 2023-01-27 at 7 39 54 PM

Screen Shot 2023-01-22 at 10 27 21 PM

Screen Shot 2023-01-22 at 7 58 26 PM

Screen Shot 2023-01-30 at 3 56 09 PM

Usage

Install by cloning the repo

git clone https://github.com/statvej/miniRT.git

Then compile by using make And run the program with scene input as command line argument

./miniRT scenes/reflective_corner.rt

It's posible to create your own scenes or change pre-made ones. Here are options for objets

Abbriviation Name Properties
c camera Center, direction, fov
A ambient light intensity, collor
l light position, intensity color
sp sphere position, diameter, color, material
pl plane position, surface normal, color, material
cy cylinder position, tube axis direction, diameter, length, color, material
tr trinagle point1, point2, point3, color, material
hy hyperboloid origin point, axis orientation, semi-major axis parameteres, radius, color, material

Materials are stored as numbers, here are explanation of what those numbers mean:

Number Type
1 Regular surface
2 Reflective surface
3 Refractive (only with spheres)
4 Earth texture no bump (only with spheres)
5 Mirror
6 Space texture (only with spheres)
7 Checkered surface
8 Sun texture (only with spheres)
9 Moon texture no bump (only with spheres)
10 Mars texture no bump (only with spheres)
11 Mercury texture no bump (only with spheres)
12 Venus texture no bump (only with spheres)
13 Jupiter texture no bump (only with spheres)
14 Earth texture WITH bumps (only with spheres)