Hair export: root UVs in the head UV set they belong to #326

Manually merged
github merged 2 commits from gh-pr/326/head into gh-pr/326/base 2026-11-26 20:27:38 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-26 00:57 UTC · original
holdmysocks:issue-146-uv → master · +197 −20 · 4 files · 2 commits · merged 2026-11-26 01:09 UTC

Follow-up to #312 for #146: the hair's root UVs now land on the head's UV map in Blender.

What the root UVs are
A groom's stored root UVs turned out to be coordinates in one of the head mesh's own UV sets, not in its first one. On Jason's head, scalp hair is UV set 3 (median difference 0.000) and brows, lashes and beard are UV set 2 (0.000 to 0.023); the next-best set is at least 0.06 off. No byte of the groom header separates the two cases, so the set is found by matching.

Changes

  • outfit --hair reads back the head mesh it has just written, matches each piece's root UVs against every UV set at the guide roots, and records the set in the piece's extras (head_uv_set, head_mesh). It takes the best set when its median is under 0.05 and less than half the next set's.
  • scripts/blender_hair_curves.py uses that set as each hair object's surface UV map, with the game's root UVs as surface_uv_coordinate. Where the set overlaps itself under the roots (one of Jason's lash pieces), it falls back to the first UV map under each root.
  • Fixes the hair material's input name (Melanin Redness); the script from #312 stopped on it in Blender 5.3.
  • README updated; new unit test for the set match.

Checked in Blender 5.3 headless on Jason's default look: all 11 pieces matched their set (scalp 3, face 2). The head point at each strand's surface UV lies a median 0.1 to 1.2 mm from its root, or 2 to 4 mm on scalp pieces whose guide roots sit that far above the skin. A Cycles render on the GPU looks as before.

**@⁠holdmysocks** on GitHub · 2026-11-26 00:57 UTC · [original](https://github.com/holdmysocks/SixNG/pull/326) `holdmysocks:issue-146-uv` → `master` · +197 −20 · 4 files · 2 commits · merged 2026-11-26 01:09 UTC Follow-up to #312 for #146: the hair's root UVs now land on the head's UV map in Blender. **What the root UVs are** A groom's stored root UVs turned out to be coordinates in one of the head mesh's own UV sets, not in its first one. On Jason's head, scalp hair is UV set 3 (median difference 0.000) and brows, lashes and beard are UV set 2 (0.000 to 0.023); the next-best set is at least 0.06 off. No byte of the groom header separates the two cases, so the set is found by matching. **Changes** - `outfit --hair` reads back the head mesh it has just written, matches each piece's root UVs against every UV set at the guide roots, and records the set in the piece's extras (`head_uv_set`, `head_mesh`). It takes the best set when its median is under 0.05 and less than half the next set's. - `scripts/blender_hair_curves.py` uses that set as each hair object's surface UV map, with the game's root UVs as `surface_uv_coordinate`. Where the set overlaps itself under the roots (one of Jason's lash pieces), it falls back to the first UV map under each root. - Fixes the hair material's input name (`Melanin Redness`); the script from #312 stopped on it in Blender 5.3. - README updated; new unit test for the set match. **Checked** in Blender 5.3 headless on Jason's default look: all 11 pieces matched their set (scalp 3, face 2). The head point at each strand's surface UV lies a median 0.1 to 1.2 mm from its root, or 2 to 4 mm on scalp pieces whose guide roots sit that far above the skin. A Cycles render on the GPU looks as before.
- The groom's root UVs are coordinates in one of the head mesh's own UV
  sets (scalp hair: set 3, brows, lashes and beard: set 2 on the player
  heads checked); the groom does not say which
- outfit --hair matches them against every UV set of the exported head
  and names the set per piece (head_uv_set, head_mesh)
- The Blender script uses that set as the surface UV map and the game's
  root UVs as surface_uv_coordinate; where the set overlaps itself under
  the roots it falls back to the first UV map under each root
- Fix the hair material's melanin redness input name
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:27:36 +00:00
github manually merged commit 05963d99de into gh-pr/326/base 2026-11-26 20:27:38 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.