Ped clothing colours from the wardrobe tint palettes #46

Manually merged
github merged 1 commit from gh-pr/46/head into gh-pr/46/base 2026-11-26 20:05:33 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-23 13:26 UTC · original
holdmysocks:claude/ped-colours → master · +412 −14 · 11 files · 1 commits · merged 2026-11-23 13:36 UTC

Ped clothing now exports in the colours the wardrobe stores, through the game's tint palettes.

What the data says

  • Most clothing shaders (ped_standard_muv and relatives) bind no colour texture. Their packed data map (slot 739e3d0d) holds R = 255, G = the fabric shade and B = a flat per-region value.
  • The colour comes from a tint palette: 21 textures of 64×256 RGBA8 sRGB in textures.rpf (ped_tint_generic_clean, ped_tint_vstation_generic, ped_tint_hair, animal_tint_* …).
    • They are stored in the Gfx10 SW_4KB_S layout. The dictionary decode scrambles them, because it assumes another tiling for 4-byte texels.
    • Each row is one colour as a dark-to-light ramp in texels 2–55.
  • A wardrobe item (f795e8ba) names its palette by the joaat of that texture name (5ecf9331), and gives three tint bytes (c4d75d79, f4fb3dec, ab5d2a85) that are the rows of tints 0–2; 255 means off.
  • Rule: walk up the parent chain; the first item whose bytes are not 255,255,255 (inherit) or 0,0,0 (unset) sets the tint. It uses its own palette, or ped_tint_vstation_generic when it names none.
  • Checked against the items' own colour tags: 48 K items in packs.rpf are tagged black, white, blue, red or green.
    • Row tint 0 at mid shade matches on 61 % overall: 68 % for vstation_generic, 71 % for vstation_special, and 27 % for generic_clean, whose bytes look like run-time placeholders.
    • As the default palette, vstation_generic does best (61 %, against 58 % for its desaturated twin and 37 % for generic_clean).
    • 39 % of tagged items store a tint at all.

Changes

  • pedtint (new): palette loading from textures.rpf, the tint rule, the shade-to-palette bake, and --tint parsing.
  • ped-variations: each item gets a tint (spec, palette, palette name, rows, the item that set it, whether the default palette is used). Each variation gets a tints string for outfit --tint.
  • outfit --tint drawable=palette:r0.r1.r2,… / ExportOptions::ped_tints.
  • Export: a shader with no colour texture whose 739e3d0d map looks like a shade map gets a baked base-colour texture: palette row tint 0 at G, or grey G for parts without a tint. It is recorded as ped_tint in the material extras.
  • README Peds row and an example.

Checked

  • Arcade zombies (2b21010, 2b34010): 10 of 43 female and 12 of 75 male variations store tints. Duty shirt → navy (mid colour 27,42,86); casual shirt → magenta; chinos → cream; flip-flops → navy; tanktop → near black.
  • Garments whose items store no tint (most trousers and T-shirts) come out shaded grey: in game they are coloured at run time.
  • Unit tests on synthetic data: tint rule, spec parsing, ramp sampling, bake, SW_4KB_S texel order and wardrobe field reading. The core suite passes (123), and the GUI crate compiles.

Not done

  • Tints 1 and 2 are not applied: how the data map's R and B pick them is not decoded, so multi-colour garments show their main colour.
  • Items' 46d26d93 (an ARGB colour on a few texture sets) is not used.
  • Palette fcef23e3 (eyes, teeth, belts) is not in the tint dictionary.
**@⁠holdmysocks** on GitHub · 2026-11-23 13:26 UTC · [original](https://github.com/holdmysocks/SixNG/pull/46) `holdmysocks:claude/ped-colours` → `master` · +412 −14 · 11 files · 1 commits · merged 2026-11-23 13:36 UTC Ped clothing now exports in the colours the wardrobe stores, through the game's tint palettes. ## What the data says - Most clothing shaders (`ped_standard_muv` and relatives) bind **no colour texture**. Their packed data map (slot `739e3d0d`) holds R = 255, G = the fabric shade and B = a flat per-region value. - The colour comes from a **tint palette**: 21 textures of 64×256 RGBA8 sRGB in `textures.rpf` (`ped_tint_generic_clean`, `ped_tint_vstation_generic`, `ped_tint_hair`, `animal_tint_*` …). - They are stored in the Gfx10 `SW_4KB_S` layout. The dictionary decode scrambles them, because it assumes another tiling for 4-byte texels. - Each row is one colour as a dark-to-light ramp in texels 2–55. - A wardrobe item (`f795e8ba`) names its palette by the joaat of that texture name (`5ecf9331`), and gives three tint bytes (`c4d75d79`, `f4fb3dec`, `ab5d2a85`) that are the rows of tints 0–2; 255 means off. - Rule: walk up the parent chain; the first item whose bytes are not 255,255,255 (inherit) or 0,0,0 (unset) sets the tint. It uses its own palette, or `ped_tint_vstation_generic` when it names none. - Checked against the items' own colour tags: 48 K items in packs.rpf are tagged black, white, blue, red or green. - Row tint 0 at mid shade matches on **61 %** overall: 68 % for vstation_generic, 71 % for vstation_special, and 27 % for generic_clean, whose bytes look like run-time placeholders. - As the default palette, vstation_generic does best (61 %, against 58 % for its desaturated twin and 37 % for generic_clean). - 39 % of tagged items store a tint at all. ## Changes - `pedtint` (new): palette loading from `textures.rpf`, the tint rule, the shade-to-palette bake, and `--tint` parsing. - `ped-variations`: each item gets a `tint` (spec, palette, palette name, rows, the item that set it, whether the default palette is used). Each variation gets a `tints` string for `outfit --tint`. - `outfit --tint drawable=palette:r0.r1.r2,…` / `ExportOptions::ped_tints`. - Export: a shader with no colour texture whose `739e3d0d` map looks like a shade map gets a baked base-colour texture: palette row tint 0 at G, or grey G for parts without a tint. It is recorded as `ped_tint` in the material extras. - README Peds row and an example. ## Checked - Arcade zombies (`2b21010`, `2b34010`): 10 of 43 female and 12 of 75 male variations store tints. Duty shirt → navy (mid colour 27,42,86); casual shirt → magenta; chinos → cream; flip-flops → navy; tanktop → near black. - Garments whose items store no tint (most trousers and T-shirts) come out shaded grey: in game they are coloured at run time. - Unit tests on synthetic data: tint rule, spec parsing, ramp sampling, bake, SW_4KB_S texel order and wardrobe field reading. The core suite passes (123), and the GUI crate compiles. ## Not done - Tints 1 and 2 are not applied: how the data map's R and B pick them is not decoded, so multi-colour garments show their main colour. - Items' `46d26d93` (an ARGB colour on a few texture sets) is not used. - Palette `fcef23e3` (eyes, teeth, belts) is not in the tint dictionary.
Clothing shaders without a colour texture are coloured through the ped
tint palettes of textures.rpf (64x256 sRGB, Gfx10 SW_4KB_S): the item's
palette hash and tint bytes pick a row, the packed data map's G the
position on its ramp. ped-variations lists each item's tint and each
variation's tints; outfit --tint applies them; untinted parts are shaded
grey. Tints 1 and 2 are not applied.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:05:31 +00:00
github manually merged commit d69d833287 into gh-pr/46/base 2026-11-26 20:05:33 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.