Skip to content

gnikoloff/webgpu-sponza-demo

Repository files navigation

WebGPU Sponza Demo

WebGPU tech demo showcasing various rendering techniques.

Screenshot 1 from the demo Screenshot 2 from the demo Screenshot 3 from the demo

About

A WebGPU deferred rendering playground written as a personal project to familiarize myself better with the API and explore various rendering techniques. As WebGPU is still considered experimental browser technology certain things might break for you.

Features

  1. glTF loading and parsing
  2. Physically based shading
  3. Cascaded shadow mapping (2 cascades)
  4. Deferred Renderer (3 MRT) with culled light volumes using a stencil buffer
  5. 400+ dynamic light sources moved in a compute shader
  6. Separate forward pass for alpha masked objects (foliage)
  7. SSAO
  8. Screen Space Reflections with the ability to switch between Hi-Z and Linear raymarching
  9. Physically based bloom
  10. Temporal Anti-Aliasing (TAA)
  11. UI controls to tweak various different rendering parameters
  12. Dynamic performance degradation if the framerate dips below 60fps for longer than 2 seconds
  13. Mobile support

Requirements

WebGPU is still considered experimental technology and might not be implemented in the version of your browser of choice. Please refer to the WebGPU Implementation Status for more info.

Dependencies

  1. @loaders.gl/gltf - Loading and parsing the glTF Sponza file
  2. webgpu-utils - Random useful things for WebGPU
  3. wgpu-matrix - Fast 3d math library for webgpu
  4. wgsl-preprocessor - Adds simple preprocessor macros to your WGSL shader
  5. hdr.js - RGBE(.hdr) file reader/writer

References and Readings

  1. WebGPU Shadow Playground
  2. WebGPU Clustered Forward Shading
  3. SSAO
  4. Screen Space Reflections: Implementation and optimization – HI-Z Tracing Method
  5. Temporal Anti-Aliasing(TAA) Tutorial
  6. Physically Based Bloom
  7. Cascaded Shadow Mapping
  8. Satin - A 3D Graphics Framework built on Apple's Metal
  9. WebGPU Spec
  10. WGSL Spec

Running Locally

  1. Clone the repo locally
  2. npm i
  3. npm run dev

Releases

No releases published

Packages

No packages published

Languages