Project

Webgiya

Surfel-based global illumination on the web using a fully compute-driven WebGPU pipeline.

TypeScript / WebGPU / Three.js / Vite Rendering, research, engineering Visit project

Webgiya explores surfel-based global illumination in the browser, asking whether a fully compute-driven WebGPU pipeline can produce convincing real-time indirect light. The write-up lives in Surfel-based global illumination on the web, with source at github.com/jure/webgiya.

Compute pipeline (per frame)

  • G-buffer raster pass writes depth, normals, and albedo for surfel spawning and resolve.
  • Surfel pool passes prepare, find missing surfels in screen space, allocate new ones, and age/recycle old ones.
  • A cascaded spatial hash grid is rebuilt every frame (clear, count, prefix-sum, slot) for neighbor lookups.
  • Integrate pass traces surfel rays against a scene BVH, updates ray guiding data, and merges MSME moments.
  • Radial depth atlas stores per-surfel visibility moments to reduce light leaks.
  • Resolve pass gathers nearby surfels with spatial/normal weighting and occlusion for the final GI buffer.

GPU data layout

The surfel pool is a set of storage buffers holding packed surfel structs (position, normal, age) plus ping-pong moment buffers, guiding coefficients, and a radial depth atlas tile per surfel. Everything stays on the GPU and is accessed via WebGPU storage buffers so the frame can remain fully compute driven.

Scenes, UI, and tooling

  • Scene presets, debug views, and lighting controls are exposed via the Three.js inspector.
  • Environment maps load from EXR/HDR and drive the sun positioning controls.
  • The pipeline runs in a Three.js WebGPU renderer with a vendored three-mesh-bvh backend for ray queries.