main
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 |
Languages
Python
100%




