A JavaScript 3D library that makes it easier to build and render 3D scenes in the browser with WebGL and WebGPU.
gkjohnson/three-gpu-pathtracer
A WebGPU path tracing renderer for three.js that uses three-mesh-bvh to produce physically based images in the browser.
- Stars
- 2,029
- Forks
- 200
- Open issues
- 63
- Last commit
- 23 hours ago
What is it?
three-gpu-pathtracer is a path tracing renderer for three.js that runs on the GPU through WebGPU compute shaders. It uses the three-mesh-bvh library to accelerate ray intersection, aiming for physically based, high quality rendering directly in the browser.
The library exposes a WebGPUPathTracer class that takes a three.js scene and camera and progressively accumulates samples each frame. It also includes a BlurredEnvMapGenerator for producing pre-blurred environment maps, which can improve convergence at the cost of sharp reflections.
The project requires WebGPU. Spot, directional and point lights are supported only with multiple importance sampling, and only MeshStandardMaterial and MeshPhysicalMaterial are rendered. The repository includes demos covering glTF loading, area and spot lights, depth of field, HDR environments, denoising and animation rendering.
Key features
- 01Path tracing for three.js scenes using WebGPU compute shaders.
- 02Accelerated ray intersection via three-mesh-bvh.
- 03Progressive sampling through a simple renderSample loop.
- 04Area, spot, directional and point light support with multiple importance sampling.
- 05Blurred environment map generation for faster convergence.
- 06Supports MeshStandardMaterial and MeshPhysicalMaterial.
Use cases
- Producing photorealistic previews of three.js product or architectural scenes in the browser.
- Prototyping physically based lighting and materials for web 3D applications.
- Rendering high quality still images or animation frames from glTF models.
Quick start
- 1
Install dependencies for running the examples locally
npm install - 2
Start the demos locally
npm start - 3
Open a demo page at localhost port 5173 with the demo name
Things to know
- The project requires WebGPU, so it will not run in browsers without WebGPU support.
- Only MeshStandardMaterial and MeshPhysicalMaterial are supported.
- SpotLights, DirectionalLights, and PointLights are only supported with MIS.
Topics
FAQ
- What is three-gpu-pathtracer?
- A WebGPU path tracing renderer for three.js that uses three-mesh-bvh to produce physically based images in the browser. three-gpu-pathtracer is a path tracing renderer for three.js that runs on the GPU through WebGPU compute shaders. It uses the three-mesh-bvh library to accelerate ray intersection, aiming for physically based, high quality rendering directly in the browser.
- Is three-gpu-pathtracer free to use? What license does it have?
- three-gpu-pathtracer is open source under the MIT license. Check the license terms before using it in commercial products.
- Is three-gpu-pathtracer still maintained?
- Actively maintained. The last commit to three-gpu-pathtracer was on Nov 6, 2026.
- What can I use three-gpu-pathtracer for?
- Producing photorealistic previews of three.js product or architectural scenes in the browser. Prototyping physically based lighting and materials for web 3D applications. Rendering high quality still images or animation frames from glTF models.
- How do I install three-gpu-pathtracer?
- Install dependencies for running the examples locally: npm install Start the demos locally: npm start Open a demo page at localhost port 5173 with the demo name
- Where can I get three-gpu-pathtracer?
- The source code and installation instructions are on GitHub: https://github.com/gkjohnson/three-gpu-pathtracer
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A JavaScript/TypeScript 3D game and rendering engine that runs in the browser on WebGL, WebGPU and WebXR.
Free online book series that teaches building a ray tracer from scratch in C++, with the full source code for each stage.
A beta Fabric mod that adds NVIDIA RTX Remix path tracing to Minecraft Java Edition 1.21.1 on GeForce RTX GPUs.
Real-time ocean renderer for three.js (WebGL2) with FFT waves, shore breakers, foam, caustics, underwater view and floating objects.
A Three.js renderer for 3D Gaussian Splatting scenes, supporting WebGPU and WebGL2 with streaming LOD for large models.