Hair export: scalp hair pressed under the outfit's hat #348

Manually merged
github merged 8 commits from gh-pr/348/head into gh-pr/348/base 2026-11-26 20:29:25 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-26 03:26 UTC · original
holdmysocks:hair-hats → master · +367 −24 · 5 files · 8 commits · merged 2026-11-26 05:33 UTC

Hair export, part of #146: hair under hats.

  • outfit --hair: when the outfit has a hat, the scalp pieces (slot "hair") are pressed under it the way the model viewer does (groom::Shell, 3 mm under the hat's lining). The guides are pressed before the strands are grown, and the grown strands again after, since noise, curl and clumps move them off the guides. This is a stand-in, not the game's method.
  • New in both the export and the viewer, Shell::press_strands: after the shell press, every strand is checked from its root against the hat's own triangles (Shell::with_lining). Where a segment crosses the hat, its far point goes back 3 mm under the hat on the line from the shell's centre, or stops 3 mm short of the crossing. The triangles are binned by direction from the centre and sampled along segments and triangles, so ones passing near the crown are found. The shell alone (5 degree cells, blended out toward the hat's edges) let tufts through the side of a cap.
  • hairexport::hat_shell: builds the shell, with its lining, from the written model GLB. The viewer takes the triangles from the loaded hat parts.
  • hairexport::piece takes the optional hat. Pressed pieces name it in their extras (under_hat), and the summary gives the points moved (hat_pressed).
  • README: replaces "export the model without the hat" with how the press works.
  • Tests: a piece under a 5 cm dome stays under it. Strands leaving a triangle dome through its pole and its side no longer cross any triangle (brute force), and a strand inside it is left alone.

Checked on Jason's look 1 (player_story000_01 --look 1, a cap worn backwards over long hair): 5 scalp pieces, 411,913 of 1.19 M points moved. In Blender 5.3, ray tests on each strand segment against the cap mesh find 69,923 crossings with the shell press alone and 2 with this change (one strand at the cap's lower edge). Cycles GPU renders from the side at ear height and from the back show no hair through the cap.

**@⁠holdmysocks** on GitHub · 2026-11-26 03:26 UTC · [original](https://github.com/holdmysocks/SixNG/pull/348) `holdmysocks:hair-hats` → `master` · +367 −24 · 5 files · 8 commits · merged 2026-11-26 05:33 UTC Hair export, part of #146: hair under hats. - `outfit --hair`: when the outfit has a hat, the scalp pieces (slot "hair") are pressed under it the way the model viewer does (`groom::Shell`, 3 mm under the hat's lining). The guides are pressed before the strands are grown, and the grown strands again after, since noise, curl and clumps move them off the guides. This is a stand-in, not the game's method. - New in both the export and the viewer, `Shell::press_strands`: after the shell press, every strand is checked from its root against the hat's own triangles (`Shell::with_lining`). Where a segment crosses the hat, its far point goes back 3 mm under the hat on the line from the shell's centre, or stops 3 mm short of the crossing. The triangles are binned by direction from the centre and sampled along segments and triangles, so ones passing near the crown are found. The shell alone (5 degree cells, blended out toward the hat's edges) let tufts through the side of a cap. - `hairexport::hat_shell`: builds the shell, with its lining, from the written model GLB. The viewer takes the triangles from the loaded hat parts. - `hairexport::piece` takes the optional hat. Pressed pieces name it in their extras (`under_hat`), and the summary gives the points moved (`hat_pressed`). - README: replaces "export the model without the hat" with how the press works. - Tests: a piece under a 5 cm dome stays under it. Strands leaving a triangle dome through its pole and its side no longer cross any triangle (brute force), and a strand inside it is left alone. Checked on Jason's look 1 (`player_story000_01 --look 1`, a cap worn backwards over long hair): 5 scalp pieces, 411,913 of 1.19 M points moved. In Blender 5.3, ray tests on each strand segment against the cap mesh find 69,923 crossings with the shell press alone and 2 with this change (one strand at the cap's lower edge). Cycles GPU renders from the side at ear height and from the back show no hair through the cap.
- grooms --full --head <model.glb> names each grown groom's head UV set,
  matched against that head (a model outfit wrote, or a head drawable
  exported on its own)
- The viewer's Export shown grooms button matches against the shown
  character's head as the viewer exported it
- Grown grooms carry their bones, so the Blender script can parent them
- The Blender script takes several hair files (one per groom)
- README: the set cannot be told from the kind of piece
Each grown piece carries the colour the viewer gives its slot: the
outfit's colour set for the slot, else the item's, from the game's strand
tables, else the item's own colour presets. COLOR_0 holds the linear
colour per point along the strand's variant ramp; the mesh extras name
the set (colour_set, colour_source). The Blender script reads it into a
colour point attribute that drives a Principled Hair BSDF.
hairexport::hat_shell builds the viewer's groom::Shell from the hat and
head meshes of the written model; piece() presses the guides before the
strands are grown and the grown strands after (3 mm under the lining).
Scalp pieces under a hat name it (under_hat) and the summary counts the
points moved (hat_pressed).
# Conflicts:
#	README.md
#	crates/sixng-cli/src/main.rs
#	crates/sixng-core/src/groom.rs
Shell::press_strands follows the shell press with a pass over each strand
from its root: where a segment crosses the hat's triangles (Shell::with_lining,
binned by direction from the centre, sampled along segments and triangles
so ones passing near the crown are found), its far point goes back 3 mm
under the hat on the line from the centre, or stops 3 mm short of the
crossing. outfit --hair reads the hat's triangles from the model GLB; the
viewer takes them from the loaded hat parts. The shell's 5 degree cells,
blended out toward the hat's edges, let tufts through the side of a cap.
# Conflicts:
#	crates/sixng-cli/src/main.rs
#	crates/sixng-core/src/groom.rs
#	crates/sixng-core/src/hairexport.rs
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:29:23 +00:00
github manually merged commit 5f8b8f20ec into gh-pr/348/base 2026-11-26 20:29:25 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.