Toon Water — Stylized Playground
App: apps/toon_water_demo/
A companion to Water Raymarch — Seascape Playground. Where that app renders
the reference water’s realistic look, this one renders its toon look — a faithful port of the owner’s
ray-marched renderToonWater onto a real mesh surface (shaders/water_toon.slang). The waves are the same
Alekseev |sin|/|cos| octave heightfield (so the buoyant floaters bob on exactly the waves you see); only
the shading differs.
The toon shading, ported 1:1 from the reference fragment:
- a banded depth palette (
toonBand) — flat cel steps from a bright shallow tint to a deep blue, with the real seabed showing through the shallows; - crisp cel foam (
crispStep) at shorelines / object contacts and on the big wave crests; - INK graphic marks on steep shadow-facing facets + a dark horizon stroke;
- banded (stepped) sun light;
- a toonSky rim reflection with hard cloud ribbons, and a sun-gold broad + hard specular.
As with the Seascape variant, the see-through is the real engine scene (seabed + physics floaters) via the grab-pass + scene depth — so crates and barrels sit in the water with a crisp foam ring at the waterline.
Run from root
Section titled “Run from root”% ./plume3d toon_water_demoControls
Section titled “Controls”- W/A/S/D move · Q/E down/up · Arrows or mouse-drag look
- SPACE spawn a crate · B spawn a barrel (both float + bob via buoyancy)
- 2 Toon (default) · 1 Seascape (compare the realistic look) · TAB cycle weather (clear/rain/snow/storm) · hold T time-of-day · R reset · ESC quit
What it shows
Section titled “What it shows”- A faithful mesh port of a ray-marched toon water look — the cel bands, foam and graphic ink read on real geometry, seeing the real scene through the surface.
- The same wave field drives the render and the buoyancy, so physics floaters ride the visible swell.
- One shader, many conditions: the toon water under clear / rain / snow / storm weather (driven by the shared
TimeOfDay+Weathercontent packs) and across the day. - Splashes, ripples and precipitation via the particle system. Like its Seascape sibling,
the water FX ride the engine’s built-in particle + instancing systems through
Scene.draw()— no hand-rolled immediate-mode draws. A floater crossing the surface bursts a flatSpriteGroundfoam ripple ring + a camera-facingSpriteBillboardsplash flash (both pinned decals reusing the sprite pipeline — see Particle FX Demo), and rain / snow are real GPU-instanced 3D geometry (InstancedMeshstreak volumes toggled by theWeatherdriver), replacing the earlier screen-space overlay; overcast states paint the animated cloud sky. The precipitation volume follows the camera (re-snapped to a grid cell each frame) so rain surrounds the diver wherever they fly, and while it precipitates the rain stipples the water — foam ripple rings burst at random points near the camera. The flat ripple rings foreshorten at this near-water camera, so they read as subtle white foam (crisp from above, as in the Particle FX Demo).
The toon palette constants (
INK/FOAM/SUN_GOLD) and the foam/band thresholds are the tunable knobs at the top ofwater_toon.slang.