Granular Sand Physics Simulator. in 3D
WebGPU Pipeline
32 Likes on X

Granular Sand Physics Simulator. in 3D

Curated 3D Web Creative Coding project by @SamGCoder • 2026-09-14

3D Graphics & Rendering Pipeline

State-of-the-art WebGPU rendering engine delivering high compute shader throughput, reduced CPU overhead, and native multi-pass buffer rendering.

Physics & Dynamic Simulation

Interactive real-time physics engine integration featuring collision detection, rigid body kinematics, and smooth motion damping.

Real-time Performance & Polish

60+ FPS browser execution with instanced rendering, memory-managed geometry buffers, and seamless responsive viewport scaling across desktop and mobile devices.

Aesthetic & Creation Overview

Developer SamG open-sources GRAIN, a granular sand physics simulator. Transpiling CUDA simulation kernels directly into WGSL compute shaders executed over WebGPU pipelines, it simulates 131,072 individual sand particles in real time—featuring hourglass funnels, dune collapse angles, pipe flow, and cursor turbulence stirring. An outstanding GPGPU benchmark demonstrating real-time granular physics in the browser.

Technical Tags & Categories

Developer Architecture & AI Prompt Engineering Guide

To study or reproduce this 3D web experience with modern AI coding assistants (Claude Code, Cursor, Codex):

# Recommended AI Prompt Template:

"Create an interactive Three.js 3D web experience based on 'Granular Sand Physics Simulator. in 3D'. Implement an antialiased WebGLRenderer with tone mapping, an OrbitControls camera with smooth damping, dynamic lighting with soft shadow mapping, and responsive resize handling. Optimize with InstancedMesh and clean render loops."

  • DevTools Shader & Draw Call Inspection: Press F12 on the demo page to inspect WebGL draw calls, shader programs, and buffer allocations.
  • Creator Devlogs: Follow @SamGCoder on X for ongoing 3D graphics updates, procedural workflows, and code snippets.

Related 3D Showcases

Explore more interactive Three.js experiments, WebGL shaders, and creative coding