ReviewOS

stacks/the-settlers-iii-remake

Match reference per-vertex terrain lighting in the browser

#218
Closed chris opened this 7 days ago ·
7 days ago

The browser terrain uses a per-face tinted overlay. The pinned remake instead computes light at each grid vertex, interpolates it over the face and multiplies source RGB in the fragment shader. Even flat visible terrain differs: an authored 128,64,32,255 source renders unchanged here, while the reference's flat light of 0.875 gives 112,56,28,255.

A separate real-browser reproduction drives the current production renderer with a one-pixel authored texture and a public engineering session. It returns the incorrect color with an unchanged simulation checksum and no browser execution errors. This finding does not depend on original media, texture-coordinate changes or Gold executable access.

Reference revision: paulwedeck/settlers-remake@6ad8c4230a4aa4cd21840f8cb59a38344e41c3e0.

  • Background.java, addPointToGeometry: interior light is max(0.4, 0.875 + (height(x,y-1)-height(x,y))*0.125), multiplied by visibility when fog is enabled. Its explicit map-edge guard also matters.
  • background.frag: multiply sampled RGB by interpolated light.
  • CommonConstants.java: fully visible is 100, explored is 50. Reference fog also has temporal dimming; the current simulation exposes binary visible/explored layers, so do not claim that steady-state lighting qualifies its complete fog behavior.

Source owner: game renderer and terrain materials in this repository. Parent #88. Preserve #215 coverage, #216 cache bounds and #217 continuous UV.

Acceptance:

  • Retain the actual flat-color regression through the maintained renderer interface, and record red and green results.
  • Compute reference light from each vertex's actual height and north neighbor, including its lower clamp and explicit map-edge behavior. Interpolate it across actual projected geometry.
  • Multiply sampled source channels by interpolated light, preserving source image bytes and alpha coverage. Remove the per-face tinted terrain approximation.
  • Apply the documented steady-state visibility weights from the simulation's existing visibility state. Verify visible, explored and unexplored vertices, mixed visibility faces and changes caused by actual public commands. Record temporal fog dimming as a remaining fidelity gap unless it is separately implemented and verified.
  • Verify gradients, channel saturation/rounding, folded and collapsed faces, chunk boundaries, camera offsets/zooms and the existing original textures at actual 1x and 2x. Use independent literal/reference expectations without arbitrary color tolerance.
  • Preserve hidden-entity filtering, source texels, simulation checksums, saves/replays, cache invalidation, allocation bounds and disposal. Run lint, types, units, assets, build and the full production browser gate; retain evidence for the pushed version.

This is a source-grounded browser lighting correction. Full landscape transitions, reference fog animation, original Gold observations and native GPU presentation remain under the broader fidelity work. A passing authored-color fixture alone cannot close #88 or establish matched original-game scenes.

7 days ago

The reference lighting correction is in main. Terrain light now comes from each vertex's actual north-height gradient, lower clamp and map-edge guard, then interpolates over the projected face before source RGB multiplication. The per-face colored overlays and their shade cache are removed.

The retained flat-color regression now passes. Actual 1x and 2x checks each pass 120,354 pixel checks, including literal gradients, all four borders, mixed visibility, saturation and an actual digger grading across a chunk boundary. Cached output matches a fresh redraw. Lint, types, all 395 unit tests, original-asset verification and the production build passed. The original tutorial also saved and restored through normal controls.

The complete local browser suite and production CI are running. This issue stays open until those reports are qualified. Visibility is qualified at documented steady states; reference temporal fog dimming, landscape transitions, Gold observations and native presentation remain open under #88.

7 days ago

The lighting correction has passed production CI. All 16 browser suites and 510 steps passed, with no console, request or collection errors. The real ten minute rival battle and save/reload checks are qualified, along with 120,354 terrain pixel checks per actual 1x and 2x scale.

The retained original diagnostic archive matches GitHub's digest and passes every CRC check. Lint, types, all 395 unit tests, original assets and the production build passed too. Closing this correction.

Terrain now uses reference vertex brightness and interpolation before source RGB multiplication, including lower clamping, final saturation and all four map edges. Actual digger grading verifies north-neighbor cache invalidation. The per-face colored overlay and shade cache are removed.

Reference temporal fog dimming remains unimplemented. Full landscape identity and material mapping are next in #219; mixed-face transitions, original Gold observations and native presentation remain broader #88 work.

Sign in to comment on this issue.