Four-layer ground: where each material's layer weights come from (vertex colours or lookup texture) #187

Manually merged
github merged 3 commits from gh-pr/187/head into gh-pr/187/base 2026-11-26 20:16:33 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-24 17:45 UTC · original
holdmysocks:claude/ground-vertex-weights → master · +63 −5 · 3 files · 3 commits · merged 2026-11-24 17:58 UTC

What

The four-layer ground shader mixes two sources of layer weights: the lookup texture and the second vertex colour set, by that set's alpha (read from the shader code, #161). This PR checks that on real meshes and records the result per material in the export.

  • multilayer.weights.source: vertex colours, lookup texture, or mixed: per vertex.
  • multilayer.weights.vertex: the attribute (_COLOR1), the vertex count, the share with alpha 1 and with alpha 0, the mean alpha, the share whose r + g + b exceeds 1, and the rule to combine the sources.
  • The two notes that called the vertex colour sets "unverified" now say what the shader does with them.

Measured

14 map tiles re-exported, about 150,000 four-layer vertices:

  • The set's alpha is 1 on 98.4 % of the vertices of the most used variant (…_dpm_dm_hbb) and on 58 to 100 % of the other eight variants. 45 of that variant's 47 materials have it at 1 on every vertex.
  • r + g + b stays at or below 1 (1.008 with rounding) on seven of the nine variants, as weights do. On the two …_spx_dm_hbb variants 149 of 41,812 vertices exceed it.
  • On the tile compared in detail, the lookup texture sampled at each vertex picks the same dominant layer as the vertex colours on only 20 to 59 % of vertices. So where the alpha is 1, blending from the lookup texture alone gives a different picture.

Checked

  • A re-exported tile: seven materials vertex colours, four lookup texture, three mixed: per vertex.
  • cargo test -p sixng-core passes (new assertions in the four-layer test).

Not checked, not done

  • Not compared with a rendered image of the game. The claim that the second colour set is the shader's weight input rests on one shader's input list and on the data behaving like weights; in the most used variant's own program the inputs are packed without names.
  • The exporter records the source; it does not bake or apply the weights. The viewer does not blend ground layers.
  • The tint (first colour set and the data maps' alpha) is described but not applied.
  • Statistics come from each material's first populated LOD.
**@⁠holdmysocks** on GitHub · 2026-11-24 17:45 UTC · [original](https://github.com/holdmysocks/SixNG/pull/187) `holdmysocks:claude/ground-vertex-weights` → `master` · +63 −5 · 3 files · 3 commits · merged 2026-11-24 17:58 UTC ## What The four-layer ground shader mixes two sources of layer weights: the lookup texture and the second vertex colour set, by that set's alpha (read from the shader code, #161). This PR checks that on real meshes and records the result per material in the export. - `multilayer.weights.source`: `vertex colours`, `lookup texture`, or `mixed: per vertex`. - `multilayer.weights.vertex`: the attribute (`_COLOR1`), the vertex count, the share with alpha 1 and with alpha 0, the mean alpha, the share whose r + g + b exceeds 1, and the rule to combine the sources. - The two notes that called the vertex colour sets "unverified" now say what the shader does with them. ## Measured 14 map tiles re-exported, about 150,000 four-layer vertices: - The set's alpha is 1 on 98.4 % of the vertices of the most used variant (`…_dpm_dm_hbb`) and on 58 to 100 % of the other eight variants. 45 of that variant's 47 materials have it at 1 on every vertex. - r + g + b stays at or below 1 (1.008 with rounding) on seven of the nine variants, as weights do. On the two `…_spx_dm_hbb` variants 149 of 41,812 vertices exceed it. - On the tile compared in detail, the lookup texture sampled at each vertex picks the same dominant layer as the vertex colours on only 20 to 59 % of vertices. So where the alpha is 1, blending from the lookup texture alone gives a different picture. ## Checked - A re-exported tile: seven materials `vertex colours`, four `lookup texture`, three `mixed: per vertex`. - `cargo test -p sixng-core` passes (new assertions in the four-layer test). ## Not checked, not done - **Not compared with a rendered image of the game.** The claim that the second colour set is the shader's weight input rests on one shader's input list and on the data behaving like weights; in the most used variant's own program the inputs are packed without names. - The exporter records the source; it does not bake or apply the weights. The viewer does not blend ground layers. - The tint (first colour set and the data maps' alpha) is described but not applied. - Statistics come from each material's first populated LOD.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:16:32 +00:00
github manually merged commit 609810113d into gh-pr/187/base 2026-11-26 20:16:33 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.