
Surf In A Box: Raymarched Breaking Wave
by @wavebinderSurf In A Box: a raymarched surf shader.
The maker wrote these words. Spawn hasn't checked what they claim.
v1.2.0 · updated
Surf In A Box: a raymarched surf shader. A breaking wave drawn entirely in the shader, no wave mesh: a long ramp of water rising into a straight barrel, the lip thrown over with white torn spray, 3D-noise holes through the lip, shore-break water shading and white wash where it lands.
Read the rest
Basic triggers only: START rolls it up out of flat water and holds it fully curled; RESET sinks the whole barrel back under with a counter swell rolling out in front, ready to start again. Bring your own geometry: the mod places nothing. Place the wave by grabbing the whole thing in god mode: move, turn or scale it where you want it, and riders follow it there. Give any thing of yours the property mods/surf-in-a-box/surf, an at and a size (the wave's own is [120, 25, 242], long side along z), plus passable: true, and the wave is marched inside that box. The START/RESET buttons show when you're within 300 m of one; your own code can call surfStart and surfReset from surf.js instead. No collision mesh: for a surf or jet ski game, ride.js gives surfaceAt(wave, x, z), the water's top height there from the same barrel maths the shader draws, and slopeAt(wave, x, z), how steeply it climbs, so a board or a ski can sit on the face, lean and slide down it as it rolls and sinks. Hooks: import * as surf from "mods/surf-in-a-box/hooks" for waveAt, surfaceAt, slopeAt, pushAt (slide down the face), inBarrel (a tube ride), depthAt, state (flat, rising, curled, sinking), progress, start, reset, setOpacity, setFeather, and on("start" | "curled" | "reset" | "sunk", fn) events. The panel (behind the mod's icon, top left, in play and in god mode) holds THICKNESS for the tube wall and lip, FEATHER, OPACITY (0 clear to 100 solid), and HELPERS: a vivid glowing grid and buoys riding the water so you can see the surface the hooks read, toggled on or off, their colour picked from a wheel of chips.