Rust WebGPU examples & Tutorials
Interactive Rust, wgpu, and WGSL demos for browser WebAssembly and native rendering, each with a source-guided
article.
WebGPU Geometry Dash-style game
One-button rhythm platforming with fixed-step physics, procedural GPU visuals, and touch
controls.
WebGPU Resident Evil fixed-camera scene
GPU-skinned Claire, tank controls, and three persistent fixed-camera views of the rainy R.P.D.
approach.
WebGPU triangle
A live Rust and wgpu demo with a walkthrough of vertex buffers, WGSL shaders, and the render
pipeline.
WebGPU vertex attributes
Compare interleaved and separate buffers, with a Rust and WGSL walkthrough of strides, offsets, and
shader locations.
WebGPU CPU particle system
Simulate 512 fire and smoke particles in Rust, stream their instance data, and render them as
camera-facing billboard quads.
WebGPU compute particles
Update 262,144 particles in 1,024 compute workgroups, ping-pong two storage buffers, and render the
GPU-written state as additive billboards.
WebGPU compute cloth simulation
Spring-connected cloth grid simulated in compute shaders and rendered as a sphere-colliding mesh.
WebGPU compute culling and LOD
Compute shader frustum culling, LOD bucketing, compacted instance buffers, and indirect draws.
WebGPU Nanite-style mesh rendering
Adapter-scaled populations, virtual geometry pages, meshlet LODs, two-pass HZB occlusion, indirect
rasterization, and GPU skinning.
WebGPU Metropolis renderer
Forward+ Sponza scene with GPU culling, indirect draws, animated crowds, dynamic shadows, reflections,
GI, and post-processing.
WebGPU N-body simulation
Evaluate 151 million pairwise interactions with tiled workgroup memory, then render 12,288 additive
billboards with live egui controls.
WebGPU compute shader ray tracing
Compute shader software ray tracing into a storage texture, displayed by a fullscreen present
pass.
WebGPU ray-traced shadows
Primary and secondary shadow rays traced in a compute shader over procedural scene geometry.
WebGPU ray-traced reflections
Recursive reflection bounces traced in a compute shader with a sky-gradient miss path.
WebGPU glTF ray tracing
Compute ray tracing over a skinned and textured glTF mesh with runtime skinning controls.
WebGPU ReSTIR direct illumination
Direct-light reservoirs reused across time and neighboring pixels over Sponza and animated Jax
geometry.
WebGPU ReSTIR global illumination
One-bounce path reservoirs with temporal and spatial reuse over the same animated Sponza test
scene.
WebGPU HTML mesh
Offline-rasterized HTML surface mapped onto a 3D plane with ray-mapped pointer and keyboard
input.
WebGPU texture loading
Load a PNG in Rust and wgpu, then explore UV coordinates, samplers, bind groups, and WGSL texture
sampling.
WebGPU texture mipmap generation
Generate eleven mip levels with GPU render passes, then explore LOD and anisotropic filtering on a
rotating tunnel.
WebGPU texture cubemap
A skybox and reflective sphere, with a Rust and WGSL walkthrough of cubemap face order, cube views, and
reflection sampling.
WebGPU texture array
Seven textured quads in one draw, with Rust and WGSL notes on array layers, instancing, and texture
sampling.
WebGPU text overlay
Render FPS and Persian text over a rotating cube, with Rust notes on fonts, glyph atlases, Unicode
shaping, and overlay passes.
WebGPU 3D text mesh
Turn Latin and Persian font outlines into extruded geometry, with Rust notes on shaping, curve sampling,
indexed meshes, and WGSL lighting.
WebGPU glTF 2.0 model loading
Load the Khronos textured box from a URL, then turn its glTF nodes, mesh attributes, material, sampler,
and texture into a wgpu draw.
WebGPU glTF vertex skinning
Animate Jax with a 46-joint glTF skeleton, CPU-sampled keyframes, an uploaded matrix palette, and
four-weight WGSL skinning.
WebGPU asteroid instancing
Render 2,048 animated asteroids in one indexed draw using a static instance buffer, procedural geometry,
and six texture-array layers.
WebGPU indirect draw
Render 24,576 plants from 12 indexed indirect commands using instanced glTF submeshes and a KTX texture
array.
WebGPU multiple render pipelines
Original treasure glTF scene rendered through Phong, toon, and wireframe pipelines.
Procedural WebGPU gears
Generate three toothed meshes in Rust, share their GPU buffers, animate per-gear uniforms, and light the
moving surfaces in WGSL.
WebGPU stencil buffer outlines
Draw a toon-shaded Venus mesh twice, expand it along its normals, and mask the white silhouette with a
depth-stencil attachment.
WebGPU occlusion queries
Test a teapot and sphere with two native sample-count queries, asynchronous readback, and an explicit
browser-safe fallback.
WebGPU radial blur
Render a glow mask to a 512 × 512 target, sample it 32 times per fragment, and additively
composite the streaks over the lit scene.
WebGPU bloom
Render a dedicated glow mesh to 256 × 256, blur it vertically and horizontally with two 9-tap
filters, then add it over the lit UFO.
WebGPU deferred shading
Write world position, normal, and albedo into three G-buffer targets, then light animated Jax and the
floor with six lights in one fullscreen pass.
WebGPU deferred multisampling
Store four samples for every position, normal, albedo, and depth G-buffer pixel, then shade and average
them manually in one fullscreen pass.
WebGPU deferred shadows
Render animated Jax into three 1024 × 1024 depth maps, then use up to 27 comparison samples while
shading eight spotlights in a fullscreen deferred pass.
WebGPU screen-space ambient occlusion
Generate a full-resolution AO mask with up to 32 spiral samples, soften it with a weighted 5 × 5
blur, and combine it with deferred shadows.
WebGPU parallax occlusion mapping
A two-triangle plane ray-marches 48 height layers from alpha, then lights RGB tangent-space normals to
create parallax occlusion.
WebGPU 4x MSAA multisampling
Render the textured Voyager in three indexed draws into 4x multisampled color and depth, then resolve
once into the surface.
WebGPU alpha-to-coverage foliage
Render 25 instanced oak trees in two indexed draws, converting leaf alpha into four-sample coverage
before resolving to the surface.
WebGPU PBR Basic
Compare metallic and roughness across 49 instanced gold spheres with a compact GGX and Schlick specular
shader.
WebGPU PBR textures
Render the Cerberus glTF with five material maps, four GGX lights, image-based lighting, and live
exposure controls.
WebGPU PBR image-based lighting
Build diffuse irradiance and a split-sum BRDF LUT on the CPU, then approximate rough reflections with
seven box-filtered cubemap mips.
WebGPU shadow mapping
Render a teapot into a 1024 × 1024 depth map, then project nine comparison samples onto a
procedural floor as the light moves.
WebGPU cascaded shadow mapping
Four frustum splits rendered into a layered depth texture, with the fragment shader sampling the
matching cascade.
WebGPU omnidirectional shadow mapping
Six cube-map light passes store point-light distance, then the scene shader samples the cube map for
omni-directional shadows.