Plip Plop! – stone skipping on photo-real lakes in three.js (custom water shader, mobile)

Hi everyone! I made a small stone skipping game. Swipe to throw, then tap every time the stone touches the water: a well-timed tap is a “Perfect” skip that keeps the stone flying. Each skip plays a higher note, so a good throw sounds like a little melody.

:play_button: Play (free, desktop and mobile): Plip Plop! – Play free online | Glowbit Games

There are 12 levels in 4 places: a sunny pebble beach, a still morning lake with a wooden dock, a sunset harbour with swell and wind, and a lake at night with fireflies and paper lanterns. You ring bell buoys, bonk rubber ducks, bounce on lily pads and thread pier posts. There is also an endless Zen Lake and a Course Maker where you can share courses as text codes.

Some technical bits

  • Photo sky from a JPEG: the far scenery and sky are CC0 Poly Haven HDR panoramas. To keep them small, the sky band is stored in a JPEG as sRGB(x / (1 + x)) and decoded back to HDR in the sky shader. So the bright sky still drives bloom and matches the image-based lighting (small .hdr files for the environment). The night lake adds stars and a moon on top.
  • Custom water shader: the lake is a camera-centred polar grid (dense near the player, 3 km out) with a ShaderMaterial. It has a planar reflection from an oblique-clipped mirror camera, Fresnel, GGX sun glitter, a tileable ocean-spectrum normal map in two scrolling layers, and analytic swells that use the same maths as the physics. On top of that come up to 32 expanding ripple rings from the touchdowns (they glow at night), depth-based clarity over the shore heightmap, shore foam, and a fade into the photo panorama at the horizon.
  • Skipping physics as a rhythm game: the stone flies ballistically with gravity, wind and a curve from the swipe. On touchdown it skips if it is fast, shallow and steady enough, and every skip costs speed. A tap close to the touchdown keeps more speed and steadies the wobble, and late tiny hops are automatic. A ring on the water shrinks to the exact touchdown spot, and the first hops slow down so you can time the taps.
  • Render-free and tested: the physics, props, levels and scoring are plain TypeScript with no three.js. Unit tests run in Node, and a solver checks that every level can be finished. The same solver tells me how many throws a player of a given skill needs for each goal.
  • A few three.js lessons:
    • r186 always creates the WebGL context with alpha. Anything that writes alpha < 1 to the screen makes the canvas see-through, so the sky writes alpha only in the mirror pass.
    • The mirror pass runs with the shadow map turned off, and it is skipped while the shadow map is being rebuilt. Otherwise you get “texture format/sampler mismatch” GL errors.
    • Toggling a light’s visible recompiles every material, so the hand fill light changes its intensity instead.
  • Look and sound: scanned CC0 pebbles, river rocks, boulders and planks; postprocessing bloom, AgX tone mapping, SMAA and vignette. All sound is Web Audio: tuned water plips on a pentatonic scale, bell buoys, duck squeaks, frogs, gulls, crickets, and a fingerpicked guitar soundtrack for each lake.

Stack: three.js r186, TypeScript, Vite, postprocessing. The JS is about 260 KB gzipped; the textures, sky photos and HDRs make up the rest.

I’d love to hear your best skip count, and how it runs on your devices!