Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Opioid/zyg
Pathtracer written in zig
https://github.com/Opioid/zyg
rendering zig
Last synced: 3 months ago
JSON representation
Pathtracer written in zig
- Host: GitHub
- URL: https://github.com/Opioid/zyg
- Owner: Opioid
- Created: 2021-07-26T07:37:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T17:35:05.000Z (9 months ago)
- Last Synced: 2024-05-22T18:04:27.245Z (9 months ago)
- Topics: rendering, zig
- Language: Zig
- Homepage: https://opioid.github.io/zyg/gallery.html
- Size: 2.89 MB
- Stars: 16
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
- awesome-zig - zyg🗒️Pathtracer written in zig
README
* zyg
[[https://opioid.github.io/zyg/images/bistro_night_720.jpg]]
[[https://developer.nvidia.com/orca/amazon-lumberyard-bistro][Lumberyard Bistro]]** Brief
zyg is raytracing renderer written in [[https://ziglang.org/][zig]]. It started as a subset of my other project, called [[https://github.com/Opioid/sprout][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 [[https://jcgt.org/published/0009/04/01/][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 [[https://github.com/DassaultSystemes-Technology/EnterprisePBRShadingModel][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 [[https://opioid.github.io/zyg/gallery.html][gallery]].
** Build
#+BEGIN_EXAMPLE
zig build -Drelease-fast=true
#+END_EXAMPLEI 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. [[https://github.com/richgel999/miniz][Miniz]] for encoding/decoding PNG images and decompressing gz archives
2. [[https://cgg.mff.cuni.cz/publications/skymodel-2021/][Hemispherical sky model]], from the source code accompanying the paper "A Fitted Radiance and Attenuation Model for Realistic Atmospheres"