Ray tracing at Ecole 42

I wrote about libft and fillit while I was still in the building. I never wrote up the ray tracer.

RTv1 is the first project: github.com/nmanzini/ray_tracer. RTv2 is the final group project of the first year. That one lived on Michiel Pauw’s machine as github.com/michielpauw/RT, with Sharfina Adamantine, Jan Roguszka, and me. I also have a copy at github.com/nmanzini/RTv2.

RTv1

First project. Ray tracer in C at Ecole 42.

The program traces rays from one camera to n objects. The objects have shading and cast shadows on each other based on the position of a single source of light.

It takes keyboard input for moving the camera (W,A,S,D,Q,E), rotate the camera (arrows), moving the light (J,K), changing resolution ([, ]) and fov angle (+, -) in the scene in real time.

It takes as input a custom file format based on comma separated values (examples in the scenes folder):

  • camera (location and direction)
  • light (location)
  • objects:
    • sphere (color, location and radius)
    • cylinder (color, location, axis and radius)
    • cone (color, location, axis and angle)
    • plane (color, normal and distance from 0,0,0)
make
./rtv1 scenes/room_sphere
Wall columns
wall_columns

This program was created without much help from standard libraries. These are all the standard functions used: open, read, write, malloc, free, sin, cos, pow, plus mlx to create a window, use keyboard input, and color a single pixel. Most standard library functions were recreated in a previous project called LIBFT.

RTv2

Final group project of the first year. Developed May–June 2018. Our goal was to render images using the ray tracing technique. This technique can create images with a high degree of visual realism, though its high computational cost means it’s not well suited for real time rendering.

The idea of ray tracing is that you trace a ray of light from a camera, through the pixels of your screen. You determine whether this ray hits an object in the scene you’re rendering, and if it does you determine whether this point on that object is lit by a light source. Intuitively, this means that you’re tracing the ray backward from camera to light source, calculating the path of one ray per pixel.

Cow
cow_rotated
Glass sphere
glass_sphere

Repos

← Blog