# MiniRT Preview

## The Raytracer

The next project i want to showcase is the miniRT (mini-raytracer).
Like the shell, this was part of the 42 curriculum, and was achieved within the same rules and constraints as the previous project.

This time, the assignment was to create a simple raytracer from scratch, using a custom wrapper around the linux X11 API, for simple window creation and I/O.

A raytracer is a program that uses a technique called "raytracing", which essentially means that we simulate looking at a scene from our "eye-position", and use the computer screen like a window through which we look at this scene.

Now, we imagine shooting a perfectly straight "ray" from our "eye" through each pixel of the screen, and trace that ray's path to see if it will intersect with an object. If yes, we know that this specific pixel can display the color of the object that it hit. We repeat this process for each pixel. Using some math to check for lighting, shadows from other objects, distance and more, we can determine a final color for each pixel, and with that create a remarkably realistic image from our scene.

On top of the basic image generation, we added some extra feature that were not required by the subject, but seemed interesting enough to learn about and implement on our own.
Some of the extra features are:

- Multithreaded
- Textures and Bumpmaps
- Dynamic Scene/Texture/Bumpmap loading
- Menus with buttons and sliders
- Simple File-Explorer to load resources at runtime
- Diffrent Reflection Models
- Objects as Perfect Mirrors
- Skybox

This project was again a team effort, my teammate Benjámin Szilas was very effective at implementing a lot of the math formulas. He is responsible for a lot of the tracing functions, he implemented shadows, reflection, light-dispersion, anti-aliasing and much more, whereas I prefered to work on the I/O focused parts like the menus, scene manipulation, file explorer and so on.
I had a lot of fun with this project, and learned a lot about working as a team, graphical programming and (some) maths!

As a final note: since we finished the project, and I was planning on showcasing it here, I have reimplemented the graphical part to use Raylib since it seemed more future proof to use.

Again, I have provided a live version below, feel free to play around in it!

Credits go to noVNC for providing the web integration, their stuff is really great!

Before you start, you will need to request the password by clicking the button below.

Loading