Introduction
Summary
Two packages for tracing rays on the GPU in the browser. @pmndrs/raytracer traces rays against a BVH from your own WGSL. @pmndrs/pathtracer builds a physically based path tracer on it, from converged reference images to one sample per pixel per frame.
Examples · GitHub · @pmndrs/raytracer on npm · @pmndrs/pathtracer on npm
What is in the box
@pmndrs/raytracer is the trace core: rays in, hits out.
- WGSL functions you paste into your own compute shader: visibility, closest hit, surface lookup.
- A batch tracer for rays in a GPU buffer.
- The scene copy: materials, textures and lights on the GPU, with light sampling and one-bounce shading.
- A glTF 2.0 loader.
The BVH and the ray walk come from @pmndrs/bvh.
@pmndrs/pathtracer is the integrator:
- OpenPBR materials: metal, glass, coats, sheen, thin film, anisotropy.
- Next-event estimation with multiple importance sampling.
- Two schedulers: a megakernel and a wavefront.
- A real-time mode that writes the planes a denoiser and an upscaler need.
Choosing a package says which one you need.
How we check it
Every feature is checked before it is a default:
The furnace tests hit their exact values, and the test scenes converge to within the two reference renderers' own disagreement.
Status labels
Some features are newer than others. Pages, examples and settings say how settled they are:
Both packages are at 0.1. Expect breaking changes between minor versions until 1.0. Each release lists them.
Next
- Installation
- Your first render: a complete program in about 50 lines.
- Loading glTF
- The examples, each one page with its source.