Hair export: grown strands in model exports, as Blender hair curves #312

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

@⁠holdmysocks on GitHub · 2026-11-25 21:17 UTC · original
holdmysocks:issue-146 → master · +636 −8 · 7 files · 2 commits · merged 2026-11-25 21:31 UTC

For #146: model exports now carry the full strand hair, not only the guide strands, in a form Blender turns into hair curves. The README also gains a section on how the game grows the strands.

Export

  • sixng outfit <character> --hair writes <out>.hair.glb beside the model, in the same space. Each piece (hair, brows, lashes and beard of the outfit --look picks) holds the strand set grown from the guides (Groom::coat, the generation and clumping from #304) as line strips, plus the guides as <piece>_guides.
  • Every point carries the strand's root UV (TEXCOORD_0), its width in metres (_WIDTH), its clump (_CLUMP, 0 = none) and its colour variant (_VARIANT). Mesh extras give points per strand, slot, placeholder, bones and groom offset.
  • Size options: --hair-density, --hair-max (strands per piece) and --hair-points (resampled along the strand). Also --hair-slots (e.g. chesthairfull, all), --hair-style REGEX for another style or beard of the character, and --hair-no-guides.
  • sixng grooms --full, and with it the viewer's "Export shown grooms" button, writes the same attributes.
  • Coat now records each strand's clump. This is the only change to the generator code.

Blender

  • scripts/blender_hair_curves.py makes one hair curves object per piece, with radius, clump, variant and root_uv.
  • With --model, each object is parented to the head bone and gets the head mesh as its surface. surface_uv_coordinate comes from the head mesh under each root, because the groom's own root UVs do not follow the head's UV map.

Checked

  • Jason (player_story000_01 --look 0): 11 pieces, 146,441 strands, a 23 MB file, about 15 s.
  • In Blender 5.3 headless, every piece came in as a hair curves object. Strand roots lie a median 0.1 to 0.8 mm from the head surface, and a Cycles render on the GPU shows the hair, beard, brows and lashes in place.
  • New unit tests: resampling, and per-piece attributes and caps.

Not in yet: curl and noise (in progress separately), pressing the hair under hats, and colour (the script uses a plain hair BSDF).

**@⁠holdmysocks** on GitHub · 2026-11-25 21:17 UTC · [original](https://github.com/holdmysocks/SixNG/pull/312) `holdmysocks:issue-146` → `master` · +636 −8 · 7 files · 2 commits · merged 2026-11-25 21:31 UTC For #146: model exports now carry the full strand hair, not only the guide strands, in a form Blender turns into hair curves. The README also gains a section on how the game grows the strands. **Export** - `sixng outfit <character> --hair` writes `<out>.hair.glb` beside the model, in the same space. Each piece (hair, brows, lashes and beard of the outfit `--look` picks) holds the strand set grown from the guides (`Groom::coat`, the generation and clumping from #304) as line strips, plus the guides as `<piece>_guides`. - Every point carries the strand's root UV (`TEXCOORD_0`), its width in metres (`_WIDTH`), its clump (`_CLUMP`, 0 = none) and its colour variant (`_VARIANT`). Mesh extras give points per strand, slot, placeholder, bones and groom offset. - Size options: `--hair-density`, `--hair-max` (strands per piece) and `--hair-points` (resampled along the strand). Also `--hair-slots` (e.g. `chesthairfull`, `all`), `--hair-style REGEX` for another style or beard of the character, and `--hair-no-guides`. - `sixng grooms --full`, and with it the viewer's "Export shown grooms" button, writes the same attributes. - `Coat` now records each strand's clump. This is the only change to the generator code. **Blender** - `scripts/blender_hair_curves.py` makes one hair curves object per piece, with `radius`, `clump`, `variant` and `root_uv`. - With `--model`, each object is parented to the head bone and gets the head mesh as its surface. `surface_uv_coordinate` comes from the head mesh under each root, because the groom's own root UVs do not follow the head's UV map. **Checked** - Jason (`player_story000_01 --look 0`): 11 pieces, 146,441 strands, a 23 MB file, about 15 s. - In Blender 5.3 headless, every piece came in as a hair curves object. Strand roots lie a median 0.1 to 0.8 mm from the head surface, and a Cycles render on the GPU shows the hair, beard, brows and lashes in place. - New unit tests: resampling, and per-piece attributes and caps. Not in yet: curl and noise (in progress separately), pressing the hair under hats, and colour (the script uses a plain hair BSDF).
- outfit --hair writes the character's strand hair to <out>.hair.glb:
  per piece the strand set grown from the guides (Groom::coat), with root
  UV, width, clump and colour variant per point, and the guides
- density, per-piece cap and resampling options keep the file small
- grooms --full writes the same attributes
- Coat records each strand's clump
- scripts/blender_hair_curves.py makes hair curves objects of it, on the
  head bone and head surface
- README: how the game grows the strands, to rebuild them in Blender
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:26:29 +00:00
github manually merged commit 785a0fb6e3 into gh-pr/312/base 2026-11-26 20:26:31 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.