garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

cartopolis-agent · 2026-11-29T06:54:15Z

docs(notes): the baked cloud mirror, designed and parked
docs/notes/water-surface.md | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/docs/notes/water-surface.md b/docs/notes/water-surface.md
index c2dede42..c9385d1e 100644
--- a/docs/notes/water-surface.md
+++ b/docs/notes/water-surface.md
@@ -8,7 +8,7 @@ triggers: [water.wesl, water.rs, "water looks", waves, ocean, sea, foam, whiteca
   transparency, "ring edge", far_water, water_common, "hole in the water",
   "painted water", RENDERED_FORMAT, water_common.wesl, ground_detail.wesl,
   vector_tiles/water.rs, map_geometry.rs, water_shore_field, Felzenszwalb, UV0]
-updated: 2026-10-17
+updated: 2026-11-28
 ---
 
 # The water surface: what is measured, and what only looked measured
@@ -430,6 +430,33 @@ counts, read from a flag in the buffer because the water pipeline has no
 `CLOUDS_LOW` def. Only the low deck: the cirrus reflection at water's few per
 cent is below what a wave does to the picture. **Not yet seen on a phone.**
 
+### Baking the mirror once a frame: designed, parked (2026-11-28)
+
+GTA VI's water reads its sky and clouds from a 512×256 target drawn once a
+frame instead of per pixel. The same here would take the cost above off the
+water's fragments and could give the mirror back the shell's full precision.
+Costed and **parked by the owner** for the price below, not because it fails.
+
+The shape that holds up: a camera-centred 2D map **over the deck plane**, not
+over directions, written by a compute pass in `Core3d` before the main pass
+(bevy's own atmosphere passes are the pattern, `bevy_pbr/src/atmosphere`). The
+water already computes the exact hit (`cf::mirror_hit`), so it looks the deck
+up where the ray lands and the waves' parallax stays right. Map the plane
+radially (`uv = hit / (|hit| + R0)`, R0 a few km), so overhead is fine and the
+horizon is coarse, as the eye sees it. Light each texel along the direction
+from the camera mirrored in the water plane. That is exact for a flat mirror
+and slow-varying otherwise. A rough mirror's cone becomes a mip level, so the
+map needs a downsampled chain, which is a dispatch per level.
+
+What makes it hours rather than a shader change: the client has **no compute
+pass at all** yet. Under `ATMOSPHERE` the deck's sunlight comes from the view
+bindings' transmittance LUT (`deck_sunlight`), which a compute pass cannot
+bind, so the baker needs its own path to that table or the reflected deck
+changes colour against the sky's. It also needs an `Rgba16Float` storage
+fallback (bevy's atmosphere checks the same), and a gate so it runs only while
+water is drawn: unlike today it would cost frames over a city with none.
+The saving is the measured 1.2–2.5 ms on lake views and nothing elsewhere.
+
 ## Shallows show their bed, without a transparent pass
 
 Inland water was opaque with a brightened edge, so a bank never read as seen