Skip to content
gonsoloPublic

About

Rendering Disney's Moana in Mojo

Resources

Stars

130 stars

Watchers

2 watching

Forks

Latest commit

 

History

2,831 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: GPL v3 Build Test Book OpenSSF Best Practices

Gonzales — Physically Based Renderer

A production-capable spectral Monte Carlo renderer written in Mojo, designed for high-end light transport simulation. Gonzales renders complex scenes — including Disney's Moana Island, all 32 Bitterli benchmark scenes and a 65-scene pbrt/Bitterli corpus — with path tracing, SPPM, BDPT and VCM on the CPU and on NVIDIA and Intel GPUs, plus an à-trous wavelet denoiser.

📖 Read the Gonzales Book for detailed documentation with annotated source code.

The whole Moana island on an RTX 3060

The whole Moana island, interactive and fullscreen on an RTX 3060 with 12 GB (video).

Gallery

Benedikt Bitterli's scenes:

Bitterli's scenes rendered with Gonzales

The pbrt-v4 scenes:

The pbrt-v4 scenes rendered with Gonzales

All rendered on an Intel Arc B580. The pbrt-v4 scenes and Bitterli's bathrooms, bedroom, cars, classroom and coffee maker: 64 samples per pixel, denoised with Intel Open Image Denoise. The other Bitterli scenes: 64 samples per pixel, or 32 SPPM passes for the two caustic scenes, denoised with Gonzales' own à-trous denoiser.

Architecture

The renderer is written entirely in Mojo (~54,600 lines in src/gonzales/, plus ~12,700 lines of unit tests) and organized into focused groups of modules:

Group Lines Responsibility
Shading and BxDFs 12,700 Diffuse, coated (pbrt's LayeredBxDF), conductor, dielectric, hair, measured, BSSRDF; spectral upsampling and sensors
Path tracer 9,900 CPU per-tile wavefront and GPU wavefront kernels, Z-Sobol sampler, film and outputs
Scene parsing 9,400 pbrt-v4 and Mitsuba parsers, PLY loader (threaded prefetch), materials, lights
BDPT / VCM 6,900 Bidirectional path tracing and vertex connection and merging (CPU and GPU)
Acceleration 4,600 SAH BVH2 (GPU) and BVH4 (CPU), instancing, native curve primitives
SPPM 3,700 Stochastic progressive photon mapping (CPU and GPU)
ReSTIR and guiding 1,900 Reservoir resampling (DI, GI, volumes, SMS) and path guiding
MNEE / SMS 1,800 Manifold next-event estimation and specular manifold sampling for glass caustics
Media 1,800 Homogeneous, uniform-grid, NanoVDB and cloud media
Denoising 650 GPU à-trous and CPU joint bilateral denoisers
Vulkan RT, RT cores, viewer 460 Second GPU backend, --rt-hardware, interactive viewer

External C/C++ libraries (OpenImageIO, Ptex, Vulkan) are called via Mojo's C FFI — not reimplemented.

Key Features

  • Spectral transport — Four hero wavelengths per path in every integrator, pbrt-style RGB-to-spectrum upsampling and sensor models
  • Wavefront GPU path tracing — GPU kernels in Mojo with live-path compaction, compile-time kernel variants, deferred software shadow rays and an optional ray-tracing hardware backend (--rt-hardware): on NVIDIA with its own acceleration-structure builders (no Vulkan or OptiX in that path), on Intel through Level Zero's ray-tracing extension and ray queries
  • Fast CPU renderer — Per-tile wavefront, 4-wide BVH with triangle records, vectorised shading
  • Four light-transport algorithms — Path tracing, SPPM (--sppm), BDPT/VCM (--vcm) and ReSTIR variants, sharing materials, lights and MIS code
  • Specular caustics — MNEE and SMS for glass and mirror caustics, with path-identity MIS so the result matches pbrt on the test cubes
  • Veach-style MIS — Power heuristic balancing NEE and BSDF sampling; Russian roulette
  • Full material set — Coated diffuse/conductor, rough and smooth dielectrics, hair, subsurface, measured BRDFs, alpha cutouts, bump and normal maps, Ptex
  • Volumes — Heterogeneous media, NanoVDB, clouds, chromatic media
  • Scene formats — PBRT-v4 (including object instancing and curves) and Mitsuba
  • Denoising — Variance-adaptive à-trous GPU denoiser (Dammertz 2010) with albedo and normal guides
  • Interactive viewer — Vulkan viewer with progressive refinement

Testing

make unittest runs ~60 unit-test files concurrently; make smoketest runs an integrator × feature matrix, and make analytictest checks renders against closed-form furnace and plane solutions.

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
v0.4 (2026) 1280×720 1/frame ~7 fps Whole island on a 12 GB RTX 3060, RT cores, interactive. Release Notes

Performance

Benchmark: Bitterli bathroom scene, 1024×1024, 64 spp, no denoiser. Hardware: AMD Ryzen Threadripper 1920X (12 cores, 24 threads), NVIDIA RTX 3060 12 GB.

Renderer Mode Wall time Notes
Gonzales GPU 4.9s Wavefront path tracing, software BVH traversal (2.9 s of it rendering)
Gonzales GPU (--rt-hardware) 6.6s Own RT-core structures; 3.3 s rendering, the rest is building them
pbrt-v4 GPU (OptiX) 4.9s Hardware RT cores
Embree pathtracer CPU 10.3s / 15.0s Bare geometry / approximate materials, no textures (earlier measurement)
Gonzales CPU 24.2s Full materials and textures (earlier measurement, not re-run)
pbrt-v4 CPU 76.2s Full materials and textures

GPU rows measured on 2026-10-12 (median of three runs). Gonzales GPU is on par with pbrt GPU on this scene. The CPU rows were not all measured on the same day, so they are not directly comparable, and Embree's tutorial path tracer has no textures and only approximate materials.

Lines of code

Project Lines (own code)
Gonzales ~66,800 (Mojo, C/C++ and CUDA under src/)
pbrt-v4 ~84,000 (excluding bundled data tables and third-party libs)
Embree kernel ~96,000 (BVH/traversal only, no rendering)

Prerequisites

Dependency Description Install (Arch)
Mojo (via uv) Compiler; GPU target requires --target-accelerator sm_XX uv run mojo
OpenImageIO EXR/HDR image I/O yay openimageio
Ptex Per-face texture mapping (Disney) yay ptex
Vulkan Interactive viewer yay vulkan-icd-loader
Loupe EXR image viewer (for make view_release) yay loupe

For GPU rendering, set --target-accelerator to match your GPU's compute capability (e.g. sm_86 for RTX 3060, sm_89 for RTX 4090).

Installation

Building from Source

make debug    # debug build
make release  # optimized release build

Getting Started

  1. Download scenes from Bitterli (PBRT-v4 format) or pbrt-v4-scenes
  2. Quick test — render and view a Cornell Box:
    make view_release
  3. Or render any scene directly: .build/release/gonzales path/to/scene.pbrt
  4. Environment switches (caches, memory budgets, logs): gonzales --list-env lists them; the table is src/gonzales/core/env.mojo.

Acknowledgments

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

© Andreas Wendleder 2019–2026

About

Rendering Disney's Moana in Mojo

Resources

Stars

130 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages