Builtin Library
- ..
- .metadata17 B
- README.md989 B
- bindings.yaml155 B
- shader.wgsl5.4 KB
README.md
compute_ocean
Ocean wave simulation. Displaces a mesh's vertex buffer in place by a sum of Gerstner waves, recomputing each normal analytically from the wave derivatives.
steepness sets how far the surface travels along each wave's direction as well
as up. At 0 every vertex stays on its rest column and the result is a plain
sine height field; raising it sharpens crests and broadens troughs, which is the
shape that reads as a wave rather than a ripple. Values above roughly 1 / (frequency * amplitude * wave_count) make the surface self-intersect.
Bindings (see bindings.yaml): vertices (read_write array<u32> — the mesh
vertex buffer, 76 bytes/vertex, bitcast to f32), params (read array<f32> —
[time, grid_size, amplitude, frequency, wind_x, wind_z, steepness, pad]).
Usage: dispatch by identity with compute.dispatch("@builtin::shaders.compute_ocean", ...) each frame —
it resolves to the shader's stable guid and auto-compiles on first use (no setup).