Four-layer ground: height-based blend, detail array and data map channels from the shader code #189

Manually merged
github merged 5 commits from gh-pr/189/head into gh-pr/189/base 2026-11-26 20:16:43 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 17:55 UTC · original
holdmysocks:claude/ground-height-blend → master · +22 −3 · 2 files · 5 commits · merged 2026-11-24 18:27 UTC

Sits on top of #187 (open): until that merges this PR's diff also shows its commits. Description only; no behaviour change in the exporter or the viewer.

Read

The main deferred pixel program of standard_uber_4lyr_dpm_dm_hbb (the most used ground variant) for the height blend, and the tail of a layer block in the base standard_uber_4lyr program for the detail array and the data map channels. Constants are named from sixng shader-bindings.

Height-based blend, now in multilayer.height_blend as steps

  • The data map's B channel is the layer's height.
  • Height (offset and scale per layer: 03754af2, b2339a6c) times the layer weight is normalised by the largest of the four, raised to an exponent 20 - 19 * saturate((blendsoftness - 0.2) * 1.754), and renormalised.
  • A per-layer switch f24b51f2 (0 or 1) mixes the result in: final = f * W + (1 - sum f * W) * w.

Fit with the data

57 materials of that variant on 14 re-exported tiles: f24b51f2 is 0 on all four layers in 49 of them (no height blend at all), blendsoftness lies between 0.4 and 0.75 (exponents about 13 to 2), the height scale is 1 in 55 and the offset 0 in 46.

Also written down

  • detail_array: the shared texture array 0cd27763 is sampled once per layer; red and green are a detail normal, blue a brightness term.
  • data_map_channels: B = height, A = tint mask, G = a roughness-like scalar (not confirmed), R not read.
  • tint: what the shader does in words, and that the exporter does not apply it because several constant-selected branches are not resolved.

Checked

  • cargo test -p sixng-core --lib: 178 passed (new assertions in the four-layer test). The full test command could not link its example programs on this machine today (out of memory in the linker), so only the library tests ran.

Not read, not checked

  • The distance fade and a fifth term inside the height blend; the other variants' programs.
  • Read once, from one program: medium confidence. Not compared with a rendered image of the game.
**@⁠holdmysocks** on GitHub · 2026-11-24 17:55 UTC · [original](https://github.com/holdmysocks/SixNG/pull/189) `holdmysocks:claude/ground-height-blend` → `master` · +22 −3 · 2 files · 5 commits · merged 2026-11-24 18:27 UTC Sits on top of #187 (open): until that merges this PR's diff also shows its commits. Description only; no behaviour change in the exporter or the viewer. ## Read The main deferred pixel program of `standard_uber_4lyr_dpm_dm_hbb` (the most used ground variant) for the height blend, and the tail of a layer block in the base `standard_uber_4lyr` program for the detail array and the data map channels. Constants are named from `sixng shader-bindings`. ## Height-based blend, now in `multilayer.height_blend` as steps - The data map's B channel is the layer's height. - Height (offset and scale per layer: `03754af2`, `b2339a6c`) times the layer weight is normalised by the largest of the four, raised to an exponent `20 - 19 * saturate((blendsoftness - 0.2) * 1.754)`, and renormalised. - A per-layer switch `f24b51f2` (0 or 1) mixes the result in: `final = f * W + (1 - sum f * W) * w`. ## Fit with the data 57 materials of that variant on 14 re-exported tiles: `f24b51f2` is 0 on all four layers in 49 of them (no height blend at all), `blendsoftness` lies between 0.4 and 0.75 (exponents about 13 to 2), the height scale is 1 in 55 and the offset 0 in 46. ## Also written down - `detail_array`: the shared texture array `0cd27763` is sampled once per layer; red and green are a detail normal, blue a brightness term. - `data_map_channels`: B = height, A = tint mask, G = a roughness-like scalar (not confirmed), R not read. - `tint`: what the shader does in words, and that the exporter does not apply it because several constant-selected branches are not resolved. ## Checked - `cargo test -p sixng-core --lib`: 178 passed (new assertions in the four-layer test). The full test command could not link its example programs on this machine today (out of memory in the linker), so only the library tests ran. ## Not read, not checked - The distance fade and a fifth term inside the height blend; the other variants' programs. - Read once, from one program: medium confidence. Not compared with a rendered image of the game.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:16:41 +00:00
github manually merged commit 79cd537c47 into gh-pr/189/base 2026-11-26 20:16:43 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.