https://github.com/saidm96/minirt42
This project is an introduction to the beautiful world of Raytracing. the miniRT is my first ray tracer coded in C, normed and humble but functionnal.
https://github.com/saidm96/minirt42
algorithms-and-data-structures clanguage mlx phong-model raytracing
Last synced: 5 months ago
JSON representation
This project is an introduction to the beautiful world of Raytracing. the miniRT is my first ray tracer coded in C, normed and humble but functionnal.
- Host: GitHub
- URL: https://github.com/saidm96/minirt42
- Owner: SaidM96
- Created: 2022-06-20T23:51:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-03T21:17:30.000Z (about 3 years ago)
- Last Synced: 2025-04-27T22:33:35.703Z (7 months ago)
- Topics: algorithms-and-data-structures, clanguage, mlx, phong-model, raytracing
- Language: C
- Homepage:
- Size: 16.4 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# miniRT
Project at [1337](https://1337.ma).
A minimal raytracing engine wrote in C and MiniLibX.
## Index
* [Description](#description)
* [Raytracing](#raytracing)
* [Installation](#installation)
* [Definitions](#definitions)
* [Images](#images)
* [Ressources](#ressources)
## Description
Summary: This project is an introduction to the beautiful world of Raytracing.
the miniRT is my first ray tracer coded in C, normed and humble but
functionnal.
## Raytracing
Ray tracing is a rendering technique that can produce incredibly realistic lighting effects.
Essentially, an algorithm can trace the path of light,
and then simulate the way that the light interacts with the virtual objects it ultimately hits in the computer-generated world.

## Installation
1. Clone the repo:
```
https://github.com/SaidM96/Minirt42.git
```
2. `cd` into it and `make bonus` to compile it:
```
cd minirt && make bonus
```
3. Now `./miniRT_bonus ./maps/aladin_room.rt`
There are some scenes in the `maps` folder that showcase minirt.
## Definitions
Ambient lighting: `A {ratio} {color}`
* Ambient lighting ratio in range [0.0,1.0].
* R,G,B colors in range [0-255].
Camera: `C {position} {orientation} {FOV}`
* X,y,z coordinates of the view point.
* A vector with the the x,y,z axis in the range [-1,1].
* Horizontal field of view in degrees in range [0,180].
Light: `L {position} {ratio} {color}`
* X,y,z coordinates of the light point.
* The light brightness ratio in range [0.0,1.0].
* R,G,B colors in range [0-255].
Sphere: `sp {position} {diameter} {color}`
* X,y,z coordinates of the sphere center.
* The sphere diameter.
* R,G,B colors in range [0-255].
Plane: `pl {position} {orientation} {color}`
* X,y,z coordinates.
* A vector with the the x,y,z axis in the range [-1,1].
* R,G,B colors in range [0-255].
Cylinder: `cy {position} {orientation} {diameter} {height} {color}`
* X,y,z coordinates for the cylinder center.
* A vector with the the x,y,z axis in the range [-1,1].
* The cylinder diameter.
* The cylinder height.
* R,G,B colors in range [0-255].
Cone: `{position} {orientation} {diameter} {height} {angle} {color}`
* X,y,z coordinates for the cone center.
* A vector with the the x,y,z axis in the range [-1,1].
* The cone diameter.
* The cone height.
* is the tangent of half angle of the cone
* R,G,B colors in range [0-255].
Example maps/columns.rt file:
```
A 0.2 255,255,255
l -12,7,-10 0.6 255,255,255
l 12,7,-10 0.6 255,255,255
l 0,7,-10 0.6 255,255,255
C 0,5,-14 0,0,1 70
sp 0,1,-1 1.2 125,25,25
cy -5,0,-2 0,1,0 2.8 20 140,140,140
cy -5,0,10 0,1,0 2.8 20 140,140,140
cy 5,0,-2 0,1,0 2.8 20 140,140,140
cy 5,0,10 0,1,0 2.8 20 140,140,140
sp -5,0,10 4.2 140,140,140
sp 5,0,10 4.2 140,140,140
sp -5,0,-2 4.2 140,140,140
sp 5,0,-2 4.2 140,140,140
sp -5,10,10 4.2 140,140,140
sp 5,10,10 4.2 140,140,140
sp -5,10,-2 4.2 140,140,140
sp 5,10,-2 4.2 140,140,140
pl 0,0,0 0,1,0 104,104,104
pl 0,0,16 0,0,-1 25,25,178
pl 0,10,0 0,-1,0 128,0,0
```
## Ressources
https://www.gabrielgambetta.com/computer-graphics-from-scratch/basic-ray-tracing.html
https://www.youtube.com/watch?v=1HYhrx9bzP8
https://computergraphicsguide.blogspot.com/2015/08/raycasting-and-phong-shading.html
https://www.youtube.com/playlist?list=PLAqGIYgEAxrUO6ODA0pnLkM2UOijerFPv
http://hugi.scene.org/online/hugi24/coding%20graphics%20chris%20dragan%20raytracing%20shapes.htm
https://www.youtube.com/watch?v=gGKup9tUSrU&ab_channel=CemYuksel
https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-ray-tracing
http://raytracerchallenge.com/




