Skip to content

vcwild/minirt

Repository files navigation

languages license repo size

MiniRT

This project is an implementation of a Ray Tracer using the path tracing algorithm.

Brief

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

Requirements for development

These are the dependencies required for development:

Dependencies

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

Create a venv

python3 -m venv venv
source venv/bin/activate
pip install -U pip

Install norminette

pip install -U norminette

Install pre-commit hooks

pip install pre-commit
pre-commit install --install-hooks --overwrite

Docs

How the Ray Tracer algorithm works

  1. Cast a ray into the scene, and find where it strikes a surface.
  2. Cast a ray from that point toward each light source to determine which lights illuminate that point.
  3. If the surface is reflective, cast a new ray in the direction of reflection and recursively determine what color is reflected there.
  4. If the surface is transparent, do the same thing in the direction of refrac- tion.
  5. 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

References