2026-05-23 01:34:32 +02:00
2026-05-23 01:33:39 +02:00
2023-11-20 21:19:19 +01:00
2023-11-03 16:16:18 +01:00
2023-11-14 19:59:53 +01:00
2026-05-23 01:34:32 +02:00
2026-05-23 00:53:22 +02:00

pytracer

a simple python raytracer implementation


Features:

  • Lambertian diffuse
  • Metals with fuzziness
  • The classic checkerboard floor texture
  • Emissive materials
  • Optional denoiser
  • Live preview while rendering
  • PPM file output
  • Software renderer (no Hardware accel!!)

Example renders:

There are two default scenes ("scene1" and "scene2") for testing. To render them do: python src/main.py -S <scene-name> type python src/main.py for a list of options.

To create your own scene take inspiration from the examples in world.json


Denoising:

To denoise a render: Run python denoiser/denoise.py, choose the input file in the first filedialogue and choose the output folder in the second.


Project structure

Folder content
results/ All of my renders (even those from older more primitive versions of the raytracer)
└ results/denoised Denoised versions of some of the renders
└ results/fails Funny failed renders luckily i dont have many of those.. or sadly
output.ppm Default location for the resulting image file of a render (also overwriting old ones!)
src/ This is where the code resides
world.json This is the file that stores all your scenes. Choose which one to load using "--scene | -S"
requirements.txt All required librarys. Use "pip install -r requirements.txt" to install them

ARGS

ARG Aliases Default Description
-h, --help Show all possible args in a help message
--scene -S, -scn required Load a scene from world.json
--samples -s, -smp 30 Number of samples per pixel
--bounces -b, -bnc 4 Ray bounce cap
--resolution -r, -res 200x160 Image resolution as WIDTHxHEIGHT (e.g. "600x400")
--destination -d, -dest output.ppm Path to the rendered image
--preview -p, -prev true Live pygame render preview (Y/N|true/false|yes/no)
--usewhite -u, -uw false Use a white default font instead of cyan
--about -a About the project
S
Description
A simple python 3D software raytracer
Readme
24 MiB
Languages
Python 100%