# W-TREES7: tree zoom repair

## Before changing code, 9 October 2026, 11:00 CET

Test target: disposable worktree, gex44 GPU loopback port 8974. No live app.
Reference: the original town/plain/2 and village/plain/3, unchanged camera ray towards the church's bench tree.

I looked at all six before strips in W-TREES7-EVIDENCE: town/village steps, moving zoom, AO comparison and walk.

Observed:
- At 20 to 60 m the crowns are very dark, almost black in parts, with coarse dark leaf planes.
- At 62 to 78 m the centre tree becomes patchy and then changes into a smooth, grey-green smaller-looking crown.
- During the moving zoom, both settlements repeat the dark/patchy/smooth switch. This is not a one-time loading event.
- Turning AO off at exactly the same 70 m camera makes the patchwork and black leaf shapes disappear. AO on restores them.
- No white cards or whole-tree disappearance in these frames. No repeated progressive jobs: pending stays zero after the initial build.
- The card already has a dither fade. It is not simply a missing cross-fade.

Frame metadata is in before.log. Step metadata is sampled before the wait, so it describes the previous camera until the zoom sequence. This will be corrected for the precise follow-up probe.

## First repair

The stock GTAO normal override ignores tree cutouts, wind and the card's billboard projection. Tree materials now keep their own shape and cutout shader in that pass and output proper view-space normals before lighting/fog/tone mapping. AO remains on for trees and buildings. This uses Three's `allowOverride` support, not a change to GTAOPass or town-look.

I looked at normal-compare-town.jpg and normal-compare-village.jpg. The large dark solid planes at 70 to 78 m are gone. The small detailed trees still change silhouette/colour as they become cards. The distance/fade mismatch remains for the next repair. The GPU run had zero page errors.

## Fade and colour repair

Every tree part now gets the same screen-door coverage interval from the CPU's crown-centre distance. Previously the CPU used the crown centre but the shaders used the foot, several metres farther away in an aerial view. Missing/loading cards now leave full tree geometry, not partly discarded geometry. Near/far/distant levels also dissolve across narrow bands instead of snapping between shapes. A continuous blend replaces the binary switch, so jitter near a threshold cannot flip a tree between two whole shapes; separate hysteresis is not needed.

The card now pictures the last geometry level and uses that level's size correction. Its picture stores leaf colour and the existing baked crown shade, without a second fixed sun. The live town sun, sky light, fog, per-tree tint and leaf translucency are applied once, just as for the real leaves.

I looked at final-compare-town.jpg and final-compare-village.jpg. The black planar patches are gone. The 60 to 80 m swap is gradual instead of a broken crown changing to a smooth blob. Fine leaf detail still reduces with distance, as intended.

An intermediate lighting probe failed because one old shader-fade reference remained. That was removed; the rerun (`light-fixed/errors.json`) has zero page errors. The pure tests first exposed a tiny floating-point difference at a band edge; boundary checks now use a numerical tolerance.
