# Tidewater source comparison

Run `corepack pnpm test:parity` with Chrome and WebGPU. Output goes to
`.context/tidewater-parity/`. A missing GPU fails the test.

The reference is upstream commit `d32799fcd85b79fb2fde3c4254f9d3805edecee3`.
The setup verifies every source file against its Git blob hash. It also keeps
the MIT license and asset credits. The reference imports no Threetopia adapter.
The scene comparison applies the explicit renderer correction below to both sides.

Both scenes use the same viewport, camera, settings, fixed time steps, random
inputs, and shader frame number. Assets and real readbacks finish before the next
controlled frame. All visual effects stay enabled. A second reference run measures
GPU variation. Images are compared at 960 × 640.

## Coverage

- All 22 authored views, plus the spawn view, night, changed settings,
  dynamic resolution, and starting and stopping time: 28 image comparisons.
- Scene mesh inventory, frame order, camera, sky, water, boat, player, wildlife,
  and whale rig state. Numeric state tolerance is `0.000001`.
- Walking, jumping, flying, boarding, steering, reverse, both boat cameras,
  swimming, diving, surf audio, mute, and a whale launch, breach, and splash.
- All 32 audio decodes, listener and mixer inputs, source slices, playback
  rates, and sound events. This does not compare speaker output.
- Real GPU water queries with two and three frames of controlled delivery delay.
- Boat and swimmer crossings into a second region. Both regions use one water
  provider, renderer, camera, and clock.

`test:shared-world` separately checks Map/Walk, real browser input, pause/resume,
independent vessels, shared wakes, strict domain limits, and three full replacement cycles.
It checks actual GPU allocation counts after disposal.

## Fixed differences

The modular composition now follows the authored update order. Physics runs
before the camera. Water queries run before world actors. Audio, UI, resolution
changes, and input cleanup run after rendering. Package registration order does
not decide these stages. The host owns the frame loop.

The free camera uses the original speed. Wildlife receives the camera position
when flying. The audio receives the real shore field, so surf sounds follow the
visible waves. The standalone package also retains the original audio/input order.

## Source renderer defect

The raw source also has a reproducible defect with Three.js 0.186.0. At
`src/ocean/OceanFFT.js:485`, the source writes several mip levels in one shader.
Three.js identifies these storage bindings by texture alone. The writes share
one mip level. Some writes race, and higher levels remain empty. This changes
water detail and caustics between identical source runs. Mip-filtered boat
queries also change when these levels are corrected.

The correction includes the mip level and access mode in each storage binding
key. It changes no wave equation and no global Three.js prototype. A real GPU
test writes three known values. The raw dependency returns `[4, 0, 0]`. The
corrected binding must return `[2, 3, 4]`.

The pinned source files stay unchanged. The test reference uses a separate,
explicit implementation of the same binding correction. Omit `mips=corrected`
from its preview URL to inspect the raw behavior. Raw evidence is kept separately.
This is a visible source defect correction, not proof of exact raw-source pixels.
The workspace owner accepted its visual effect on 7 October 2026 after watching
the side-by-side film. This visual review point is closed. The decision is in
`docs/reviews/tidewater-mip-binding.json`, with the source revision, implementation
hashes, and video SHA-256. The full release has a separate server acceptance receipt. See the
[Three.js uniform sharing contract](https://threejs.org/docs/pages/UniformNode.html).

Run `corepack pnpm review:tidewater:video` to record this review point.
The 24-second MP4 shows raw source on the left and the explicit binding
correction on the right. Both use the same camera, source seed, and 60 Hz
simulation steps. The output has 720 frames at 30 fps and no audio.
It shows surf, shallow water, underwater lighting, and sun reflections.
The recorder decodes every output frame to check for blank or frozen video.
The film, frame preview, camera records, and verification hash are in
`.context/tidewater-parity/`. The accepted film has SHA-256
`b90c477df95eebab9792397546a2a286d45e68e923f6f772aecfa203f24aa58f`.
A new recording does not inherit this decision.

## Limits and acceptance

Both the source repeat and shared composition must stay within a fixed mean
error of 0.02 on the 0–255 RGB scale. At most 0.01% of pixels may have a channel
difference above 3. Source variation cannot increase these limits. State checks
do not use this image tolerance. Effects are not disabled to pass the test.

This is evidence for the tested source revision and GPU. It does not prove every
camera, machine, or possible neighboring scene. The boundary fixture extends
the same ocean; it does not test conflicting global environments.

The agreed shared wake extension combines two to four hull pressure and wash
sources before it updates foam, turbulence, and aeration. It keeps the authored
equations and a separate running mean filter under each hull. These filters
remove steady local height and small residuals, as in the source. They do not
separate waves by their originating boat. Transient crossing waves can pass.
One hull still uses the original solver and the full source parity tests.

The shared domain has 1024 × 1024 cells at the original 0.4 m resolution.
It keeps the original 34.4 m hull margin. The maximum source span is 340.8 m
per axis. Larger spans, more than four hulls, and insufficient GPU limits fail
explicitly. The host must request 32 KiB workgroup storage and 512 compute
invocations. Dynamic membership and merging or splitting domains are not supported.
This bounded provider does not yet solve an unrestricted world fleet.

The GPU regression compares combined sources with separate runs and reversed
source order. It checks shared nonlinear behavior, hull samples, running mean
buffers, region crossings, capacity failures, and four-hull disposal cycles.
The complete island also runs with two and four boats. Extra boats register
after the player asset. The UI reads the shared field only after registration
finishes, so entity order cannot seal the field too early.
No current vector is invented. Currents remain a separate capability.

The owner accepted this bounded wake model on 7 October 2026. The decision is
in `docs/reviews/tidewater-shared-wakes.json`. The renderer decision remains
bound to its reviewed implementation and video hashes.

The complete 0.3.0 release passed server validation and world acceptance.
`docs/reviews/tidewater-release.json` records the exact world revision, package
graph, source inventory, and server review. The normal registry route also
passes a browser test with pinned assets, Map/Walk, and pause/resume.
Existing releases and fixed-tile placements stay unchanged.
