https://github.com/jackdbd/path-tracer
unbiased Monte Carlo path tracer implemented in zig
https://github.com/jackdbd/path-tracer
illumination path-tracing raytracing-in-one-weekend
Last synced: 9 months ago
JSON representation
unbiased Monte Carlo path tracer implemented in zig
- Host: GitHub
- URL: https://github.com/jackdbd/path-tracer
- Owner: jackdbd
- License: mit
- Created: 2022-04-06T16:37:13.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-07T21:45:33.000Z (about 4 years ago)
- Last Synced: 2025-07-24T00:43:06.188Z (11 months ago)
- Topics: illumination, path-tracing, raytracing-in-one-weekend
- Language: Zig
- Homepage:
- Size: 602 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ray Tracing in one weekend in zig
[](https://github.com/jackdbd/path-tracer/actions/workflows/ci.yaml)
Implementation of Peter Shirley's [Ray Tracing in One Weekend](https://github.com/RayTracing/raytracing.github.io) book in the Zig programming language.
Tested on Zig version **0.9.1**.

## Installation
Clone the repo and jump into it:
```sh
git clone git@github.com:jackdbd/path-tracer.git
cd path-tracer
```
In order to use this library and run the examples you will need zig version **0.9.1**. You can get it using [zigup](https://github.com/marler8997/zigup):
```sh
zigup fetch 0.9.1
zigup 0.9.1
```
## Build
Build and run the executable in [debug](https://ziglang.org/documentation/master/#Debug) mode.
```sh
zig build run
```
Build the executable in [release-fast](https://ziglang.org/documentation/master/#ReleaseFast) mode, then run it.
```sh
zig build -Drelease-fast --verbose
# run it
./zig-out/bin/ray-tracing-in-one-weekend-zig
```
## Tests
Run all tests:
```sh
zig build test
```
Otherwise, run all tests defined in a single file:
```sh
zig test src/material.zig
zig test src/utils.zig
zig test src/render_targets/ppm_image.zig --main-pkg-path ./src
```
## Other
Format all zig code
```sh
zig fmt src
```
## TODO
- implement example with [async and await](https://ziglang.org/documentation/master/#Async-and-Await)
- implement more scenes
- improve documentation about Monte Carlo path tracing algorithm and global illumination model
- generate docs with `zig test src/utils.zig -femit-docs=./docs` or similar command
- fix issues with zig-clap