A production-capable Monte Carlo path tracer written in Swift 6.3, designed for high-end light transport simulation. Gonzales renders complex scenes — including Disney's Moana Island and all 32 Bitterli benchmark scenes — using modern Swift features: strict concurrency, structured task groups, and SIMD vector types.
📖 Read the Gonzales Book for detailed documentation with annotated source code.
The renderer is organized into 18 modules mirroring the architecture of PBRT:
| Module | Responsibility |
|---|---|
| Integrator | Volume path tracing with multiple importance sampling |
| Accelerators | BVH with Surface Area Heuristic |
| Sampler | Z-Sobol quasi-random sequences with Owen scrambling |
| Bsdf | Diffuse, dielectric, microfacet, coated, layered, hair, mix |
| Reflection | Fresnel equations, Trowbridge-Reitz microfacet distribution |
| Light | Area, point, distant, and infinite (environment map) lights |
| Core | Ray, spectrum, film, scene, distributions, tile renderer |
| Geometry | Vectors, points, normals, transforms, bounding boxes (SIMD4) |
| Shape | Spheres, triangle meshes, PLY, curves |
| Texture | Image textures, Ptex via C++ interop |
| Camera | Perspective camera with depth of field |
| Image | EXR output via OpenImageIO C++ interop |
- Veach-style MIS — Power heuristic balancing light and BSDF sampling
- Pure Swift BVH — Native acceleration with SAH, no Embree dependency
- Z-Sobol sampling — Low-discrepancy sequences for fast convergence
- Russian roulette — Unbiased path termination for efficiency
- PBRT-v4 format — Full scene file compatibility
- Structured concurrency — Tile-based parallel rendering via
withThrowingTaskGroup - Ptex & OpenImageIO — C++ interop for professional texture and image handling
| Version | Resolution | SPP | Time | Notes |
|---|---|---|---|---|
| v0.0 (2021) | 2048×858 | 64 | 26h | GCE 8 CPU, 64 GB |
| v0.1 (2023) | 1920×800 | 64 | 78 min | Threadripper 1920X, with Embree |
| v0.2 (2026) | — | — | — | ARC cleanup, Embree removed |
| v0.3 (2026) | — | — | — | Release Notes |
| Dependency | Description | Install (Arch) |
|---|---|---|
| Swift 6.3 | Compiler with C++20 interop | pacman -S swift |
| OpenImageIO | EXR/HDR image I/O | pacman -S openimageio |
| Ptex | Per-face texture mapping (Disney) | pacman -S ptex |
| Loupe | EXR image viewer (for make view_release) |
pacman -S loupe |
yay gonzales-githttps://aur.archlinux.org/packages/gonzales-git
make debug # debug build
make release # optimized release buildNote (Swift 6.1.2+ on Arch Linux): An incompatibility with GCC 15 requires patching
/usr/lib/swift/lib/swift/_FoundationCShims/_CStdlib.hline 55 to wrap the#if __has_include(<math.h>)block in#if 0 ... #endif.
- Download scenes from Bitterli (PBRT-v4 format) or pbrt-v4-scenes
- Quick test — render and view a Cornell Box:
make view_release
- Or render any scene directly:
.build/release/gonzales path/to/scene.pbrt
Physically Based Rendering: From Theory to Implementation has been an inspiration since the project was called lrt.
© Andreas Wendleder 2019–2026
