Tidewater: Oceans, Lakes, Rivers, Waterfalls, Swimming and Splashes Water Kit
README.md
ocean tests
Guards the oceans package where it is easiest to break silently.
The spectrum tests drive known winds through the real compute chain (spectrum,
evolution, inverse FFT, assembly), read the height field back, and assert that
significant wave height matches the Pierson-Moskowitz relation Hs = 0.21 U²/g,
that it grows with the square of wind speed, that it does not depend on grid
resolution, and that the field has no constant offset. Those four together are
what make amplitude = 1 mean a physically real sea rather than an arbitrary
gain, and a change to any constant in the spectrum shows up here.
The preset tests check that every sea state resolves to a complete
configuration, that get hands back an independent copy, and that no preset
carries a sky, fog or post-processing block: the package reads the scene for its
light and its reflections, and a preset describing them would be a second
lighting rig fighting the world's own.
The quality tests hold the line between the two tables: a tier decides how finely a sea is resolved and never what sea it is, so no tier may own the clipmap's extent.
The clipmap tests pin the extent formula and the invariant the whole displacement pipeline rests on: every vertex carries its rest position in its uv, which is the input each frame reads so displacement never compounds.
The surface tests bring oceans up and tear them down, so nothing in the lifecycle depends on a fresh engine: attach and release, sea level, the sampling contract, preset re-application with overrides, the seabed following the sea state, and two tiers of the same preset agreeing on what sea it is.
The seabed's ground tests cast rays into the collision patch and compare what they find against the patch's own heights. Ground drawn a metre from where it is stood on reports nothing, so the comparison runs across the whole patch rather than at its centre (a patch placed at the wrong origin, or read with its rows and columns swapped, agrees in the middle and diverges everywhere else), and it asserts the relief is real, because flat ground would agree wherever it was put. The rest holds the patch to the width that makes its readback safe, and holds a seabed asked for no collision, and an ocean being torn down, to leaving no invisible ground standing in open water.