Animals: colour textures from material presets; variants without parts #25

Manually merged
github merged 1 commit from gh-pr/25/head into gh-pr/25/base 2026-11-26 20:03:54 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-23 01:59 UTC · original
holdmysocks:claude/animal-materials → master · +397 −7 · 13 files · 1 commits · merged 2026-11-23 02:20 UTC

What was wrong

  • Cat without eyes (crm_cat_feral_m_00). The eye drawable binds a colour texture that is in no store.
  • Rainbow cows (crm_cattle_holstein_f_00, _m_00). The coat's diffusetex is a tint mask in a linear format: R and B are patch masks, G is the shading. The game colours it at runtime.
  • Flat white panes (crm_chimpanzee_western_m_01). A variant root with no parts of its own, so only its placeholder plane was shown.

What the data says

Each animal has one packs.rpf meta resource of material presets (struct f795e8ba, the one head skins already read). A preset has a name hash, a slot (fullbody, head, eyes, teeth, fur …), albedo and normal hashes, three tint bytes and a tint palette hash. The first preset of a part is named after its drawable; the others are its variations (coats, eye colours).

What changed

  • New partskin module: the preset table per animal, cached as <work>/index/part_skins.json (260 animals, 2,636 presets).
  • An animal part whose colour texture is missing or is a tint mask takes a preset's texture: the preset named after the part first, then the slot's first ready-painted (sRGB), untinted one. model.json records the choice as part_skin.
  • A coat with only tinted presets (the Holstein bull) is marked classification.tint_mask; the viewer shows the mask's green channel as grey instead of the raw mask.
  • A variant root without parts takes the parts of the lowest-numbered sibling that has them.
  • Viewer: cached animal parts from before this change are exported again.
  • Research examples presets and texhash.

Checked

  • cargo test -p sixng-core: all pass, with two new partskin tests.
  • Rendered in the rebuilt viewer: the cat's eyes (textured), the Holstein cow (painted white with black patches), the bull (grey shading), crm_chimpanzee_western_m_01 (assembles from the m_00 parts).

Not done

  • Tint palettes. 708 presets use one of 7 palettes (32-bit name hashes, not found in any store or name list). Tinted coat variations are not shown, and the bull is grey.
  • Fur. The fur_* drawables are 3-vertex placeholders and their presets do not name a groom; the link from an animal to its strand grooms is still unknown.
  • Looks. Struct a9d57751 in the same resources lists one preset per slot (whole-animal looks). Not used yet.
  • That the m_01 chimpanzee uses the m_00 meshes is an assumption; nothing stored confirms it.
  • Only the animals named above were rendered. The Metal renderer ignores tint_mask.
**@⁠holdmysocks** on GitHub · 2026-11-23 01:59 UTC · [original](https://github.com/holdmysocks/SixNG/pull/25) `holdmysocks:claude/animal-materials` → `master` · +397 −7 · 13 files · 1 commits · merged 2026-11-23 02:20 UTC ## What was wrong - **Cat without eyes** (`crm_cat_feral_m_00`). The eye drawable binds a colour texture that is in no store. - **Rainbow cows** (`crm_cattle_holstein_f_00`, `_m_00`). The coat's `diffusetex` is a tint mask in a linear format: R and B are patch masks, G is the shading. The game colours it at runtime. - **Flat white panes** (`crm_chimpanzee_western_m_01`). A variant root with no parts of its own, so only its placeholder plane was shown. ## What the data says Each animal has one packs.rpf meta resource of material presets (struct `f795e8ba`, the one head skins already read). A preset has a name hash, a slot (`fullbody`, `head`, `eyes`, `teeth`, fur …), albedo and normal hashes, three tint bytes and a tint palette hash. The first preset of a part is named after its drawable; the others are its variations (coats, eye colours). ## What changed - New `partskin` module: the preset table per animal, cached as `<work>/index/part_skins.json` (260 animals, 2,636 presets). - An animal part whose colour texture is missing or is a tint mask takes a preset's texture: the preset named after the part first, then the slot's first ready-painted (sRGB), untinted one. `model.json` records the choice as `part_skin`. - A coat with only tinted presets (the Holstein bull) is marked `classification.tint_mask`; the viewer shows the mask's green channel as grey instead of the raw mask. - A variant root without parts takes the parts of the lowest-numbered sibling that has them. - Viewer: cached animal parts from before this change are exported again. - Research examples `presets` and `texhash`. ## Checked - `cargo test -p sixng-core`: all pass, with two new `partskin` tests. - Rendered in the rebuilt viewer: the cat's eyes (textured), the Holstein cow (painted white with black patches), the bull (grey shading), `crm_chimpanzee_western_m_01` (assembles from the `m_00` parts). ## Not done - **Tint palettes.** 708 presets use one of 7 palettes (32-bit name hashes, not found in any store or name list). Tinted coat variations are not shown, and the bull is grey. - **Fur.** The `fur_*` drawables are 3-vertex placeholders and their presets do not name a groom; the link from an animal to its strand grooms is still unknown. - **Looks.** Struct `a9d57751` in the same resources lists one preset per slot (whole-animal looks). Not used yet. - That the `m_01` chimpanzee uses the `m_00` meshes is an assumption; nothing stored confirms it. - Only the animals named above were rendered. The Metal renderer ignores `tint_mask`.
Animal parts take their colour texture from the animal's material presets
(packs.rpf meta, struct f795e8ba, the one head skins use) in two cases:

- the drawable binds a texture that is in no store. Cat eyes rendered
  blank; the preset named after the eye drawable has the real texture.
- the drawable binds a tint mask (cattle: R and B are patch masks, G the
  shading, in a linear format), which rendered as orange, pink and green
  patches. The game colours it from the preset's three tint bytes through
  a tint palette. That lookup is not decoded, so the part takes the first
  preset of its slot with a ready-painted (sRGB) albedo. The Holstein cow
  has one; the bull does not, so its coat is marked
  classification.tint_mask and the viewer shows the mask's green channel
  as grey.

New module partskin: the preset table per animal (name, slot, albedo,
normal, tint bytes, palette hash, tagged drawables), cached as
<work>/index/part_skins.json (260 animals, 2,636 presets). model.json
records the choice as part_skin.

A variant root with no parts of its own (crm_chimpanzee_western_m_01: a
skeleton only, shown as a flat pane) takes the parts of the
lowest-numbered sibling that has them.

Viewer: cached animal parts from before this change are exported again.

Research examples: presets (print a resource's presets or another
struct), texhash (decode textures by store hash).

Not done: the tint palette lookup (708 presets use one of 7 palettes), so
tinted coat variations are not shown; fur (the fur_* drawables are
3-vertex placeholders and the presets do not name a groom).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:03:50 +00:00
github manually merged commit ba94d49457 into gh-pr/25/base 2026-11-26 20:03:54 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.