A (nearly) pure Ray Tracing Project for Python
This work is based off the books Ray Tracing in One Weekend and Ray Tracing: the Next Week by Peter Shirley but ported to Python.
This project seeks to expand past these previous works to become a more fully fledged path-tracer
dependencies include:
- pypy3 (note all other dependencies must be installed within pypy3)
- numpy
- matplotlib
- tqdm
- noise
- Install Anaconda
- conda env create -f environment.yaml
- conda activate PyTrace_env
- pypy3 -m ensurepip
- if on mac you may need to fake a linked library described here
- pypy3 -m pip install -r requirements.txt
- pypy3 main.py
Technically, you can run w/o pypy3 installed but it is very slow w/o the JIT compilation, as seen below
- Add more features such as different sampling methods, more materials, etc
- Optimizations (Better BVH creation, memory and operation optimizations)
- Arbitrary geometry support (mostly polygonal meshes)
- Scene descriptions and parser
- CUDA optimizations
Note: Iterations per second are how many output pixels are processed per second
2048 spp
800 x 800
Standard Implementation w/ PyPy
avg: 116.79 it/s
time: 1:31:19
2048 spp
800 x 800
Standard Implementaiton w/ Pypy
avg: N/A
time: ~ 3 Hours
256 spp
1200 x 800
Standard implementation
avg: 73.34 it/s
time: 4:10:06
256 spp
1200 x 800
Standard implementation w/PyPy
avg: 4953.02 it/s
time: 00:03:13
100 spp
200 x 100
Standard implementation
avg: 179.90 it/s
time: 00:01:50
100 spp
200 x 100
Standard implementation w/ PyPy
avg: 10819.22 it/s
time: 00:00:01
256 spp
1200 x 800
Standard implementation w/PyPy
avg: 307.16 it/s
time: 00:52:01
64 spp
200 x 100
Standard implementation w/PyPy w/o cprofile
avg: 1207.04it/s
time: 00:00:06