TinyTracer is a Python path tracer that simulates light paths to generate realistic images.
This project is part of Winter of Open Source, where contributors can improve the engine, add materials, implement new shapes, optimize performance etc.
Some demos may look noisy due to low sampling for faster renders.
Implemented so far:
- Sphere and Quadrilateral geometry
- Four material types: Lambertian, Metal, Dielectric, Emissive
- Multiprocessing for faster rendering
- Basic caching optimizations
git clone https://github.com/datavorous/tinytracer.git
cd tinytracer
python3 -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
pip install -e .
pip install uv pytest
The generated image will be in
.ppmformat, inside theoutputfolder.
Run the TinyTracer renderer using uv:
uv run tinytracer/main.pyAdvanced controls:
uv run main.py [-help] [--format {png,ppm}] [--width WIDTH] [--height HEIGHT] [--samples SAMPLES] [--output OUTPUT] [--depth DEPTH] [--aspectratio ASPECTRATIO]The generated image will be in .ppm format by default at tinytracer\output folder.
To run tests:
uv run pytest-
widthTo adjust width of output image.uv run main.py --width=INTEGER # Default = 400 -
heightTo adjust width of output image.uv run main.py --height=INTEGER # Default = 225 -
aspectratioTo adjust aspect ratio of output image (OVERRIDDEN if both height and width given)uv run main.py --aspectratio=X:Y # Default = 16:9 -
samplesTo adjust number of samples per pixel.uv run main.py --samples=INTEGER # Default = 200 -
depthTo adjust depth of ray tracing.uv run main.py --depth=INTEGER # Default = 50 -
outputTo select file output path ( INCLUDING FILENAME ).uv run main.py --output=PATH # Default = tinytracer/output/image.ppm -
formatTo select file output format [ png / ppm ]uv run main.py --format={png/ppm} # Default = ppm
This project has issues prepared for contributors at all levels: Open Issues
Each issue is labeled by difficulty (
good-first-issue,easy,medium,hard) and has clear instructions.
Please follow CONTRIBUTING.md for step-by-step guidance on:
- Setting up your environment
- Choosing and assigning issues
- Branching, committing, and creating PRs
- Code style and formatting rules (using
black) - PR acceptance criteria and points system
Warning
Work on only one issue at a time.
Please follow CODE_OF_CONDUCT.md to ensure a welcoming and productive environment for all contributors.
- Ray Tracing in One Weekend (Part 1 and Part 2)
- Understanding the Viewport
- See explained.md for additional explanations.





