Contents

gonsolo/gonzales

A production-capable Monte Carlo path tracer written in **Swift 6.3**, designed

Architecture

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 |

Key Features

  • 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

Rendering Moana

| 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 |

Prerequisites

| 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 |

Installation

Arch Linux (AUR)

yay gonzales-git

<https://aur.archlinux.org/packages/gonzales-git>

Building from Source

make debug    # debug build
make release  # optimized release build

Note (Swift 6.1.2+ on Arch Linux): An incompatibility with GCC 15 requires patching /usr/lib/swift/lib/swift/FoundationCShims/_CStdlib.h line 55 to wrap the #if _has_include(<math.h>) block in #if 0 ... #endif.

Getting Started

  1. Download scenes from Bitterli (PBRT-v4 format) or pbrt-v4-scenes
  2. Quick test — render and view a Cornell Box:

``bash make view_release ``

  1. Or render any scene directly: .build/release/gonzales path/to/scene.pbrt

Acknowledgments

Physically Based Rendering: From Theory to Implementation has been an inspiration since the project was called lrt.

© Andreas Wendleder 2019–2026

Package Metadata

Repository: gonsolo/gonzales

Default branch: main

README: README.md