Tide
A gallery of four scenes built to show water — open sea, coast, valley and courtyard — of which the first milestone builds the courtyard: a tiled pool with a deep end and a shallow end under a fixed sun, its still surface refracting the tile under it, absorbing more with depth and reflecting the sky. The other three are empty rooms until the milestones that fill them. Not a game: the water is the content.
the gallery, from the page
Every knob the sample binds to a key, as something a finger can reach.
Natively these are N, M and C, and rows on the pause panel. A phone has none of them. Each button below writes the same cell the key writes and then reads back the name the engine holds, so the labels are never a copy the page keeps of its own.
- Which scene is drawn
- What the water is made of
- Which camera the scene is seen through
- Every knob back to where a run opens
what you are looking at
Three things, and each one is a water claim you can check.
The deep end against the shallow end. The two halves of the pool are mirror images seen from the camera's column, so the only thing that separates them is how much water is over the tile. The deep end should read darker and bluer — and under the swamp preset, browner.
The tile through the surface. The lane line on the pool's floor is bent by the water it is seen through: it sits higher in the frame than it would with the pool drained, and the shallow end bends it less than the deep end does.
The coping around it. The water stands a hand's width below the rim, and the stone around the pool is exactly the stone it would be with no water in it at all: the surface is drawn where the pool is and nowhere else.
controls
Nothing to play. There is a camera, and there are the knobs above.
The page opens on the fixed pose the golden frames are taken from, over the clear pool. The orbit camera turns round the pool on the simulation's own fixed step, so it is the same pose at the same tick on every machine.
- Move on to the next scene, medium or camera N, M, C
- Fly the free camera W A S D, Space and Shift for up and down, the arrows to look
- Every knob back R
- Pause and resume Esc
- Fullscreen F11
- Debug overlay F3
- Debug console `
- Pause, fullscreen and the debug overlay keys — unless a control for them is listed above
- Debug console, and its on-screen keyboard the CONSOLE button, once you have touched the canvas
why this one is worth publishing
Because water is a system, and this is where the system is looked at.
The engine's water is data first: a body is an outline, a level and a medium, and the renderer is one reader of it. This page is that reader in a browser. Press F3 for the receipts: the panel names which geometry path, which binding model and which lighting path this frame was drawn through, which body and medium the frame drew, and what the two water passes — the copy of the frame behind the surface, and the surface itself — cost on this device.
what is actually running
The native sample, with three differences the browser forces.
Start-up is polled across several frames, because
requestDevice is a promise and the main thread cannot block on
it. The frame loop is driven by requestAnimationFrame out here
rather than by a loop inside the engine. And the clock is the
browser's, because wasm32-unknown-unknown has no
Instant.
There is no fourth difference about saved data: this demo keeps nothing and
loads nothing — the courtyard's geometry is built from literals in
apps/tide, and the shaders and the font atlas are compiled into
the module.
console.log, so log lines are queued
inside wasm and drained by the page each frame. crcbl.audio(),
crcbl.saves() and crcbl.logLevel(4) are there too.