TypologySienna Chen
MotionMiddleweight

GPGPU compute

The graphics card as a calculator.

Using the graphics card as a calculator: the simulation runs inside textures, thousands of things updated at once. This is how a million particles, fluids and reaction-diffusion patterns run at 60 fps.

Breaks when
float texture support varies on mobiledebugging is blind
Also called
GPUComputationRenderer, FBO particles, compute shader, ping-pong

Prompts

Reaction–diffusion wallpaper
Gray–Scott reaction–diffusion on ping-pong RGBA16F textures in WebGL2 at 512²: 8 simulation steps per frame, f = 0.037, k = 0.06, Du = 0.21, Dv = 0.105 (with 9-tap Laplacian), seeded by a few disks and by the pointer. Display v through a two-color ramp on a paper background. Fall back to RGBA8 with scaled values when EXT_color_buffer_float is missing. Freeze when off-screen.
Particles with GPUComputationRenderer
Three.js GPUComputationRenderer with two variables (position, velocity) on 256×256 textures: velocity shader applies curl noise and a pointer attractor, position shader integrates and respawns dead particles; render with a Points material that reads the position texture by UV in the vertex shader. Explain the texture-as-array indexing.
WebGPU compute with a fallback
Write a WebGPU compute shader (workgroup 8×8) that runs the same Gray–Scott step on a storage texture, and a WebGL2 fragment-shader version of the same step; a runtime check picks one. Same visual output, same parameters, same seed. Report the ms per step for each.

Related

Resources · 2