Skip to content

Opioid/zyg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zyg

https://opioid.github.io/zyg/images/bistro_night_720.jpg Lumberyard Bistro

Brief

zyg is raytracing renderer written in zig. It started as a subset of my other project, called sprout, but manually translated from C++ to zig.

I began working on this project, because I had heard many promising things about zig and was curious to try it out for myself. Due to a lack of imagination I could not come up with a better idea than redoing my hobby renderer in a different language.

Since then I have completely transitioned to this codebase, though. The overall structure is still very similar to sprout and all the important features are also present here. There are however already various deviations and improvements. Two of the more obvious one are, that zyg is using an Owen scrambled Sobol sequence to generate samples, and that the main material model now uses a simple Lambertian diffuse BRDF and energy compensation as in the DSPBR material model. But there are a lot of smaller improvements everywhere and the code is in overall better shape (partially benefitting from a restart, so to speak).

When I last compared the performance of the two renderers side by side, zyg was slightly slower in most of the scenes I tried, producing a virtually identical image. But the timings where so close to the c++ version, that I don’t worry about it. Today the underlying algorithms differ in some cases, and even the scene description is not fully compatible any more, so I stopped comparing render timings.

Gallery

A few images rendered with zyg can be found in the gallery.

Build

zig build -Drelease-fast=true

I keep updating the source code, to be compatible with the latest unstable version of the zig compiler, every couple of weeks. It will not work with the current stable release.

I have only tested the build on linux so far.

Dependencies

I try to keep the number of dependencies as low as possible. Apart from the zig std-lib, there are only 2 dependencies, but their source code is directly included in the repository.

  1. Miniz for encoding/decoding PNG images and decompressing gz archives
  2. Hemispherical sky model, from the source code accompanying the paper “A Fitted Radiance and Attenuation Model for Realistic Atmospheres”