ANSI terminal raytracer in C++
Go to file
dvdrw 294cd72ee7
tweak lights to make scene more interesting
2023-12-03 21:56:53 +01:00
include init: create git repo 2022-12-17 18:29:17 +01:00
src tweak lights to make scene more interesting 2023-12-03 21:56:53 +01:00
.gitignore init: create git repo 2022-12-17 18:29:17 +01:00
Makefile feat: impl random sampling instead of point light algorithm 2023-12-03 21:20:49 +01:00
README feat: impl random sampling instead of point light algorithm 2023-12-03 21:20:49 +01:00

README

A raytracer that will render to any ANSI terminal with support for 24-bit
colours, at least 80x24 big.

Build with `make' and run the resulting binary in `/bin'.

The raytracer implements the following:
 - Planes, spheres, and point lights
 - Reflection
 - IOR-based refraction
 - Cook-Torrance BRDF (a few other models are left in the code)
 - Primitive object materials
 - Random sampling (build with `make randsampl' to add fireflies :)

You can move around with WASD and SPC/Z; zoom with I/O, change the exposure with
+/-, and quit with Q.

The image output is a 24-bit coloured 80x24 (by default, tweakable in
`main.cpp'), 2x supersampled. The output uses Unicode characters and differently
coloured foreground and background to effectively double the output resolution.
You can read the implementation in `buffer.cpp'.

The raytracing loop is parallelised using an OpenMP pragma, which should be well
supported on most systems. You can just comment out the pragma (and remove the
omp flag from the Makefile) to remove parallelisation.

Although the code isn't particularly documented, most functions have a docstring
in their respective header files. Most fun things to play around with are
located in `main.cpp'.