Skip to content

Arjun-Arora/PyTrace_Weekend

Repository files navigation

PyTrace_Weekend

image2

A (nearly) pure Ray Tracing Project for Python

This work is based off the books Ray Tracing in One Weekend but ported to python

dependencies include:

  1. pypy3 (note all other dependencies must be installed within pypy3)
  2. numpy
  3. matplotlib
  4. tqdm
  5. noise

Quickstart guide:

  1. Install Anaconda
  2. conda env create -f environment.yaml
  3. conda activate PyTrace_env
  4. pypy3 -m ensurepip
  5. if on mac you may need to fake a linked library described here
  6. pypy3 -m pip install -r requirements.txt
  7. pypy3 main.py

Technically, you can run w/o pypy3 installed but it is very slow w/o the JIT compilation, as seen below

PyTrace_Weekend Benchmark:

Note: Iterations per second are how many pixels

W/ current scene:

256 spp

1200 x 800

3 Large spheres

Standard implementation

avg: 73.34 it/s

time: 4:10:06

W/ current scene:

256 spp

1200 x 800

3 Large spheres

Standard implementation w/PyPy

avg: 4953.02 it/s

time: 00:03:13

W/ current scene:

100 spp

200 x 100

3 Large spheres

Standard implementation

avg: 179.90 it/s

time: 00:01:50

W/ current scene

100 spp

200 x 100

3 Large spheres

Standard implementation w/ PyPy

avg: 10819.22 it/s

time: 00:00:01

W/ random scene:

256 spp

1200 x 800

3 Large spheres + random spheres

Standard implementation w/PyPy

avg: 307.16 it/s

time: 00:52:01

W/ random scene:

100 spp

1200 x 800

3 Large spheres + random spheres

Standard implmentation w/PyPy

avg: 952/75 it/s

time: 00:16:47

W/ random scene:

64 spp

200 x 100

3 Large spheres + random spheres

Standard implementation w/PyPy w/o cprofile

avg: 1207.04it/s

time: 00:00:06

Releases

No releases published

Packages

No packages published

Languages