Skip to content

thekorn/raytracing-zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raytracing in one Weekend in Zig

Read the book at: https://raytracing.github.io/books/RayTracingInOneWeekend.html

requirements

  • Zig >= 0.13.0

render the scene

$ zig build run && open out.ppm

unit testing

$ zig build test --summary all

convert the result to png

$ docker run -v $(pwd):/imgs \
    dpokidov/imagemagick /imgs/out.ppm /imgs/current.png

build options

$ zig build -Doptimize=ReleaseFast
$ zig build -Doptimize=ReleaseSmall

Benchmarking

$ hyperfine -N --warmup 3 './zig-out/bin/raytracing-zig'

Benchmark 1: ./zig-out/bin/raytracing-zig
  Time (mean ± σ):     151.5 ms ±   3.4 ms    [User: 147.4 ms, System: 1.9 ms]
  Range (min … max):   149.4 ms … 163.4 ms    20 runs

Current rendering

curret rendering

References