webgpu-pt

monte carlo path tracer
Contents

Live

This GPU-intensive scene currently requires Chrome, as Firefox’s WebGPU support is incomplete, and Linux support on Chrome is also still under development. There’s some basic material and lighting interaction present as well. There is a different scene available if you clone and run the repo locally.

Launch the live version here

Clone

git clone https://git.jun.sh/webgpu-pt.git

Screenshots

Overview

An interactive path tracer implemented in WGSL. Supports multiple sampling methods, physically based materials including micro-facets, and realistic light sources. Primarily written to explore WGSL and the WebGPU API. So it takes some shortcuts and is pretty straightforward.

This is a GPU “software” path tracer, since there is no HW-accel using RT cores, it contains manual scene intersections and hit tests.

Some code pointers

Local setup

pnpm install 
pnpm run dev

/public should contain the assets. Just compose the scene manually in main.ts position, scale, rotate. All the included models are licensed under Creative Commons Attribtution 4.0.

To-do

Resources

Scattered thoughts