This project is an implementation of a Ray Tracer using the path tracing algorithm.
A ray tracer is a program that takes a scene and a camera and renders the scene to a screen. The properties of a ray tracer are:
- The camera has position and a direction
- The camera can be rotated, zoomed in and out, and moved around the scene
- The objects in the scene have a color, shape, material and position
- There is light in the scene
- The light emits rays that intersect with objects in the scene
These are the dependencies required for development:
Install libs
sudo apt-get update && sudo apt-get install xorg libxext-dev zlib1g-dev libbsd-dev
If you want to run tests on project clone munit into /tests folder
git submodule init
python3 -m venv venv
source venv/bin/activate
pip install -U pip
pip install -U norminette
pip install pre-commit
pre-commit install --install-hooks --overwrite
- Cast a ray into the scene, and find where it strikes a surface.
- Cast a ray from that point toward each light source to determine which lights illuminate that point.
- If the surface is reflective, cast a new ray in the direction of reflection and recursively determine what color is reflected there.
- If the surface is transparent, do the same thing in the direction of refrac- tion.
- Combine all colors that contribute to the point (the color of the surface, the reflection, and refraction) and return that as the color of the pixel.
This project uses minilibx-linux MinilibX, a simple X-Window (X11R6) programming API in C, designed for students, suitable for X-beginners.
Unofficial documentation for minilibx