← All resources

2D Grass Rendering with WebGPU Compute Shaders

Auto-discovered

Blog Intermediate

Jarl Devs Team

Visit resource ↗

Description

Jarl Devs Team wrote this post on procedural 2D pixel-art grass for Jarl, a Bevy 0.11 and wgpu Viking colony sim. It includes a live WebGPU demo that runs the same WGSL as the shipped renderer.

Each frame rebuilds grass as an image: grass_generate.wgsl hashes blades from density and wind, rasterizes with atomicMax depth packing, then grass_unpack.wgsl shades winners for compositing with sprites, GI, and fog.

The article explains density and wind inputs, floor masks, PCG hashing, half-res scaling, optimization notes, and credits GPU Gems and Ghost of Tsushima grass work. Full shader sources are at the end.

It suits intermediate programmers who know compute basics and want a WebGPU or wgpu case study for 2D, not a beginner shader tutorial.

The page is a detailed implementation reference with demo and code rather than a widely cited community standard.