Skip to content

chrislawlor/pytracer

Repository files navigation

pytracer

Ray tracing in Python. My implementation of The Ray Tracer Challenge by Jamis Buck.

3d spheroid

Examples

Examples assume iTerm with imgcat installed.

If imagecat is not installed, pipe output to a .ppm file instead of into imgcat, and open with macos Preview, or another program that supports PPM files (try IrfanView).

Before running examples, be sure to install the project:

$ poetry install

Render a scene from a YAML file

pytracer examples/scene_reflection.yaml --width 1600 --height 800 |imgcat

multiple reflective spheres example

Transparency

pytracer examples/transparency.yaml --width 1000 --height 500 | imgcat

transparency example

World and Camera

$ poetry run python examples/world_and_camera.py | imgcat

world and camera example

Creating a PPM image from a pytracer Canvas

$ poetry run python examples/canvas_to_ppm.py | imgcat

canvas to ppm example

Acknowledgements

  • Ray Tracer Challenge book:

  • Color palette for sample image:
    cheer_up_emo_kid

About

Ray tracer, implemented in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages