Fifth project into 42Network. miniRT is my first contact with graphics and raytracing. It features lambert law, Möller-Trumbore ray-triangle intersection and some other cool stuff :)
This project introduces the following topics:
You will have to make some changes to make sure MiniLibX can be properly used.
The way I recommend installing it is by compiling MiniLibX from sources (which can be found on intra project page, or by using this instance minilibx)
and copying mlx.h
into /usr/local/include/mlx.h
and libmlx.a
to /usr/local/lib/libmlx.a
Then proceed the same way as if you were on a 42 iMac
To make it work on 42 iMacs, you need to clone somewhere (to make it easier, under srcs/
is a good option) both libft and get_next_line as they are required dependencies.
The following step is to compile it, you can do it with a simple make
, or if you cloned the dependencies somewhere that is not under srcs
, using make MINIRT_LIBFT=../relative/path/to/libft MINIRT_GNL=/absolute/paths/work/too
will do the job.
An output file called miniRT
will be produced (otherwise message me, mmartin-
on Slack).
Program usage is ./miniRT <rt_file> [--save]
. If --save
is not specified,
a window will open with the rendered content of the file. If --save
is specified,
a screenshot.bmp
image will be generated.
The structure of a .rt
file is as follow:
| Parameter | Arguments | Usage example |
|———————————————-|————————————————————————————————————————————————————|——————————————————-|
| R
| A
| c
| l
| sp
| pl
| sq
| cy
| tr
First of all, I had to learn maths from scratch. At the start of the project I didn’t know nor understand any of linear algebra or trigonometry.
For this matter, I used 3blue1brown Linear Algebra resources.
Talking about resources, the list for everything I’ve used to learn about this topic (and even rasterization and similar topics):
The project consists of four parts:
This project took me too long because of the mathematic base I had to adquire. It will be greatly improved over time, but as I cannot submit it
again it will remain with 100/100 (with bonus it would be 100/115).