Viewer: the primer's colour from the material palette #350

Manually merged
github merged 2 commits from gh-pr/350/head into gh-pr/350/base 2026-11-26 20:29:35 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-26 04:01 UTC · original
holdmysocks:primer-colour → master · +187 −17 · 6 files · 2 commits · merged 2026-11-26 04:26 UTC

Viewer: the primer layer takes its colour from the material palette, as the game does, instead of a stand-in grey.

What the game does (read from its code; addresses in the code comments)

  • Each colour record (f1379639) carries six primer palette entries: two primer types × three primer sets, each a row and a slice. Type 0 set 0 is the row and slice the viewer already reads for the part's own colour.
  • A part's primer type is its surface record's primerType (78b545dd, u8 at +0x3c): 563 surfaces have 0, 194 have 1.
  • A set whose row is -1 takes set 0 of the same type, row and slice both. In the data, type 0 sets 1 and 2 are filled in on 754 of the 1,851 records (slice 5); type 1 sets 1 and 2 never are.
  • The part's set is the first of a per-vehicle random order of 0, 1, 2 that its primerSets mask allows (the masks in use are 1, 2 and 7).
  • The shader reads the row at column win(summed primer mask, primerGradientStart, primerGradientEnd - primerGradientStart), with no tint.

Changes

  • Export: part_colours.primer (format 24 / export version 29), per look and per part id the primer rows for sets 0 to 2 (12 hex digits). Vehicles are exported again when the viewer opens them.
  • Viewer: the part ramp image gets 256 more rows (primer row per part id). The coat row gets the gradient window in columns 46 and 47. The shader samples the row there. A part with no primer row stays grey.
  • Viewer: a "primer set" slider (0 to 2) and --primer-set. These pick the set for parts whose mask allows several, standing in for the game's random choice.

Not covered

  • The primer's roughness and metalness still come from the library's primerPalette (the game takes them from the primer surface record).
  • What the global primerPalette row (tintRow 0) is used for.
**@⁠holdmysocks** on GitHub · 2026-11-26 04:01 UTC · [original](https://github.com/holdmysocks/SixNG/pull/350) `holdmysocks:primer-colour` → `master` · +187 −17 · 6 files · 2 commits · merged 2026-11-26 04:26 UTC Viewer: the primer layer takes its colour from the material palette, as the game does, instead of a stand-in grey. **What the game does** (read from its code; addresses in the code comments) - Each colour record (`f1379639`) carries six primer palette entries: two primer types × three primer sets, each a row and a slice. Type 0 set 0 is the row and slice the viewer already reads for the part's own colour. - A part's primer type is its surface record's `primerType` (`78b545dd`, u8 at +0x3c): 563 surfaces have 0, 194 have 1. - A set whose row is -1 takes set 0 of the same type, row and slice both. In the data, type 0 sets 1 and 2 are filled in on 754 of the 1,851 records (slice 5); type 1 sets 1 and 2 never are. - The part's set is the first of a per-vehicle random order of 0, 1, 2 that its `primerSets` mask allows (the masks in use are 1, 2 and 7). - The shader reads the row at column `win(summed primer mask, primerGradientStart, primerGradientEnd - primerGradientStart)`, with no tint. **Changes** - Export: `part_colours.primer` (format 24 / export version 29), per look and per part id the primer rows for sets 0 to 2 (12 hex digits). Vehicles are exported again when the viewer opens them. - Viewer: the part ramp image gets 256 more rows (primer row per part id). The coat row gets the gradient window in columns 46 and 47. The shader samples the row there. A part with no primer row stays grey. - Viewer: a "primer set" slider (0 to 2) and `--primer-set`. These pick the set for parts whose mask allows several, standing in for the game's random choice. **Not covered** - The primer's roughness and metalness still come from the library's `primerPalette` (the game takes them from the primer surface record). - What the global `primerPalette` row (`tintRow` 0) is used for.
Each colour record's primer entries (per surface primerType and primer
set, with the game's fallback to set 0) are exported per look as
part_colours.primer; the viewer puts each part's row in the part ramp
image and the shader reads it at the column the primer's summed mask
gives through primerGradientStart / primerGradientEnd. A primer set
slider stands in for the game's per-vehicle random pick.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:29:33 +00:00
github manually merged commit 9045b4f12d into gh-pr/350/base 2026-11-26 20:29:35 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.