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.

Check out the accompanying frame analysis article here.

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

License

Copyright (c) 2024 Georgi Nikolov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 
associated documentation files (the "Software"), to deal in the Software without restriction, 
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, 
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

WebGPU tech demo showcasing various graphics techniques

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages