Tint palettes: row layout from the game's mesh shader (SIX-41) #432

Manually merged
github merged 1 commit from github-bot/gh-432 into gh-pr/432/base 2026-11-27 03:03:12 +00:00 AGit
Owner

@⁠holdmysocks on GitHub · 2026-11-27 01:48 UTC · original
holdmysocks:six41-tint-layout → master · +29 −11 · 3 files · 1 commits · merged 2026-11-27 02:57 UTC

SIX-41: the row rule for tint palettes, read from the game's prop mesh shader (MS_VS_TransformD_c5fd36bb).

The shader rule: with k = width & 7, each row holds 256 >> k entries, there are width >> (8 − k) rows, and the entry read is min(tint, rows − 1) × (256 >> k) + round(255 × COLOR0.b).

  • texture::tint_layout now computes the shader rule directly. Where the rule gives no whole row, it falls back to one row of the full width. Among the palette widths in use, only width 32 (7 palettes) hits that fallback, so it keeps the layout it had before.
  • Every other width in use gets the same layout as before (checked against all 127,287 embedded palettes). The old formula differed only for unused widths with k ≥ 6.
  • The tint_row docs (placements) and the model.json applied text now say the clamp at rows − 1 is the game's, not an assumption.
  • Tests: the layout table now includes 32 and 260, and a new test checks agreement with the old layout where the two should match.

Follow-up for the tint weight the pixel shader applies: SIX-245.

**@⁠holdmysocks** on GitHub · 2026-11-27 01:48 UTC · [original](https://github.com/holdmysocks/SixNG/pull/432) `holdmysocks:six41-tint-layout` → `master` · +29 −11 · 3 files · 1 commits · merged 2026-11-27 02:57 UTC SIX-41: the row rule for tint palettes, read from the game's prop mesh shader (MS_VS_TransformD_c5fd36bb). The shader rule: with k = width & 7, each row holds 256 >> k entries, there are width >> (8 − k) rows, and the entry read is min(tint, rows − 1) × (256 >> k) + round(255 × COLOR0.b). - `texture::tint_layout` now computes the shader rule directly. Where the rule gives no whole row, it falls back to one row of the full width. Among the palette widths in use, only width 32 (7 palettes) hits that fallback, so it keeps the layout it had before. - Every other width in use gets the same layout as before (checked against all 127,287 embedded palettes). The old formula differed only for unused widths with k ≥ 6. - The `tint_row` docs (placements) and the model.json `applied` text now say the clamp at rows − 1 is the game's, not an assumption. - Tests: the layout table now includes 32 and 260, and a new test checks agreement with the old layout where the two should match. Follow-up for the tint weight the pixel shader applies: SIX-245.
tint_layout now computes the rule read from the prop mesh shader
(k = width & 7, rows of 256 >> k entries, width >> (8 - k) rows, row
clamped at rows - 1). It agrees with the old layout for every palette
width in use except 32, which keeps one row of 32. The placement and
model.json docs now say the clamp is the game's, not an assumption.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 02:09:51 +00:00
github-bot changed target branch from master to gh-pr/432/base 2026-11-27 03:03:10 +00:00
github manually merged commit 80cea4b6fc into gh-pr/432/base 2026-11-27 03:03:12 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.