Hair: noise and curl from the groom's style groups #310

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

@⁠holdmysocks on GitHub · 2026-11-25 20:07 UTC · original
holdmysocks:claude/people-hair-shape → master · +208 −16 · 5 files · 9 commits · merged 2026-11-25 22:28 UTC

Ports the noise and curl step of the game's hair strand generation into the grown coat (viewer and --coat exports).

What it does

  • hairgen: the bit-128 step of the strand program. At arc length s from the root, each point gets a 2D offset across the strand:
    • noise: a lerp between two of 64 stored directions, hashed from the strand seed and floor(4 s Fn), scaled by the amplitude;
    • curl: a circle of the curl radius, with phase fract(Fc s + r) (r = the strand's length draw).
    • Both fade in between half the fade length and the full fade length. The offset is not cumulative.
  • groom: reads the two curl groups (system +0xF8 and +0x104, six half floats each: an unread word, fade, noise amplitude, curl radius, noise and curl frequency) into curl. The game copies the first group into the per-instance record its generator reads, so it applies to every strand. No known program reads the second. Both go into the growth JSON.
  • After merging master (#304): the offset is applied to all three populations: scattered strands after growth, and clumped strands (mode 2 and mode 16) on their walked points, with each strand's own seed and length draw. The style-record pass runs after it.
  • Viewer: grown strands are pressed under a hat again after growth, so curls and clumped strands don't come through the crown. This also fixes clumped hair poking through hats on current master.

Verified

  • The offset formula matches the game program in an interpreter on 400 random inputs, to 2.5e-7. The 64-entry table is taken from the program.
  • All tests pass, including a new unit test for curl, noise, fade and apply_style.
  • Style values across 5,599 groom pieces are plausible: curl radius 2 mm to 5 cm, frequencies of about 5 to 70 per metre. Brows, lashes and animal fur are mostly flat.
  • Before/after renders against current master on the dGPU (Jaylah, Maryam with a hat, Mandy, the feral cat). Hair edges are slightly looser. Maryam's hat is clean (master shows strands through it). The cat looks the same at this distance.

Not verified / not done

  • The game builds the offset frame from a per-vertex twist vector that is not decoded; the root triangle normal stands in. Curl size and frequency are the game's, but the direction a curl starts in may differ.
  • Both amplitudes are scaled in game by 1 - m, where m is a per-guide value not yet found; it is taken as 0.
  • Clumping (bits 2/4/8/16) is only partly read and is not ported.
**@⁠holdmysocks** on GitHub · 2026-11-25 20:07 UTC · [original](https://github.com/holdmysocks/SixNG/pull/310) `holdmysocks:claude/people-hair-shape` → `master` · +208 −16 · 5 files · 9 commits · merged 2026-11-25 22:28 UTC Ports the noise and curl step of the game's hair strand generation into the grown coat (viewer and `--coat` exports). **What it does** - `hairgen`: the bit-128 step of the strand program. At arc length `s` from the root, each point gets a 2D offset across the strand: - noise: a lerp between two of 64 stored directions, hashed from the strand seed and `floor(4 s Fn)`, scaled by the amplitude; - curl: a circle of the curl radius, with phase `fract(Fc s + r)` (r = the strand's length draw). - Both fade in between half the fade length and the full fade length. The offset is not cumulative. - `groom`: reads the two curl groups (system +0xF8 and +0x104, six half floats each: an unread word, fade, noise amplitude, curl radius, noise and curl frequency) into `curl`. The game copies the first group into the per-instance record its generator reads, so it applies to every strand. No known program reads the second. Both go into the growth JSON. - After merging master (#304): the offset is applied to all three populations: scattered strands after growth, and clumped strands (mode 2 and mode 16) on their walked points, with each strand's own seed and length draw. The style-record pass runs after it. - Viewer: grown strands are pressed under a hat again after growth, so curls and clumped strands don't come through the crown. This also fixes clumped hair poking through hats on current master. **Verified** - The offset formula matches the game program in an interpreter on 400 random inputs, to 2.5e-7. The 64-entry table is taken from the program. - All tests pass, including a new unit test for curl, noise, fade and `apply_style`. - Style values across 5,599 groom pieces are plausible: curl radius 2 mm to 5 cm, frequencies of about 5 to 70 per metre. Brows, lashes and animal fur are mostly flat. - Before/after renders against current master on the dGPU (Jaylah, Maryam with a hat, Mandy, the feral cat). Hair edges are slightly looser. Maryam's hat is clean (master shows strands through it). The cat looks the same at this distance. **Not verified / not done** - The game builds the offset frame from a per-vertex twist vector that is not decoded; the root triangle normal stands in. Curl size and frequency are the game's, but the direction a curl starts in may differ. - Both amplitudes are scaled in game by `1 - m`, where `m` is a per-guide value not yet found; it is taken as 0. - Clumping (bits 2/4/8/16) is only partly read and is not ported.
Port the bit-128 step of the strand generation program: a per-point 2D
offset across the strand, from a 64-entry direction table hashed by seed
and arc length (noise) and a circle of the curl radius (curl), faded in
over the fade length. The six values come from the groom's two style
groups (system page +0xF8 and +0x104). The root triangle normal stands in
for the game's twist vector. Clumping is still not decoded.
The game copies system +0xF4..+0x10E into the per-instance record its
strand generator reads; no known program reads the second group. Rename
the field to curl, to keep it apart from the style records.
# Conflicts:
#	crates/sixng-core/src/groom.rs
#	crates/sixng-gui/src/model_view.rs
# Conflicts:
#	README.md
#	crates/sixng-core/src/groom.rs
#	crates/sixng-gui/src/model_view.rs
# Conflicts:
#	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:26:18 +00:00
github manually merged commit 198ebc0239 into gh-pr/310/base 2026-11-26 20:26:20 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.