Skip to content

unbiased Monte Carlo path tracer implemented in zig

License

Notifications You must be signed in to change notification settings

jackdbd/path-tracer

Repository files navigation

Ray Tracing in one weekend in zig

CI

Implementation of Peter Shirley's Ray Tracing in One Weekend book in the Zig programming language.

Tested on Zig version 0.9.1.

scene 21 rendered with 150 samples per pixel, depth 6, seed 456

Installation

Clone the repo and jump into it:

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:

zigup fetch 0.9.1
zigup 0.9.1

Build

Build and run the executable in debug mode.

zig build run

Build the executable in release-fast mode, then run it.

zig build -Drelease-fast --verbose
# run it
./zig-out/bin/ray-tracing-in-one-weekend-zig

Tests

Run all tests:

zig build test

Otherwise, run all tests defined in a single file:

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

zig fmt src

TODO

  • implement example with 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

About

unbiased Monte Carlo path tracer implemented in zig

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages