Hyper-Realistic Sand with WebGL2 av.github.io · 255 points · 57 comments · HN th...

@best30

Hyper-Realistic Sand with WebGL2 av.github.io · 255 points · 57 comments · HN thread

TL;DR A WebGL2 demo called Safe Sand simulates a pile of grains that you can push with a finger, tilt the phone to slide, or shake to scatter, running in the browser on phones, tablets and desktops. The Hacker News thread is mostly delighted by the physical feel, with recurring complaints about loud audio, performance on older phones, and orientation-dependent behaviour that confused some users.

  • The page is a browser toy built with WebGL2 and JavaScript; the description promises touch interaction, tilt-to-slide and shake-to-scatter.
  • Pressing the pour button starts sand falling; the simulation responds to phone orientation, so sand pours out when the screen is tilted or upside down.
  • The stones have water around them and piled sand collapses in a way commenters find realistic, while the sound effect is widely criticised as loud and harsh.
  • Performance is uneven: several users report choppy or slideshow-like frame rates on iPhone 13/14/15 Pro and budget Android devices.
  • The source code is public at github.com/av/safe-sand.
  • Users on desktop and mobile report different experiences, and the sand texture changes with a URL parameter (?sand=beach).

Discussion The thread is mostly positive and playful, with many commenters saying the demo is fun, realistic-looking or nostalgic for sandboxes. A large share of comments are first-hand reports of setup problems: sand not appearing on Android or Brave, the view resetting on orientation change, and sluggish frame rates on older or mid-range phones. Several threads debate what counts as realistic, the audio design, and whether the physics feel right, with some jokes about bocce, snow globes and the tool's coarse grit.

  • Fun and impressively realistic toy (many): Many commenters praise the grain behaviour, the water around stones, and the way a pile collapses like real sand. Several say it brought back childhood sandbox memories.
  • Sound is too loud or harsh (many): A frequent complaint is that the pour sound is loud enough to startle, and it should default to off or come with a warning. Others say the audio cutoff is abrupt.
  • Performance is choppy on many phones (many): Users with iPhone 13, iPhone 14, iPhone 15 Pro and budget 2021 Android phones report very low frame rates, while a few on newer devices say it runs fine.
  • Orientation and tilt behaviour is confusing (some): People who first saw nothing happen found that the sand only responds when the phone lies flat, and that rotating the device resets the layout. Locking orientation helped some.
  • Not realistic: sand sticks, stones do not roll (some): Critics say sand hovers or gets stuck, stones never rotate, grains bounce back under pressure, and the motion has an uncanny-valley quality. Some also feel the grains move too fast and lack friction.
  • Setup issues on Android and some browsers (a few): A few report that nothing happens on certain Android phones or in Brave, which they traced to blocked permissions.

Links from the comments

#WebGL #sandSimulation #browserGames #javascript #physicsDemo