Hair: hold the settled guides on the game's leash #457

Manually merged
github merged 4 commits from github-bot/gh-457 into gh-pr/457/base 2026-11-27 05:54:49 +00:00 AGit
Owner

@⁠holdmysocks on GitHub · 2026-11-27 04:43 UTC · original
holdmysocks:people/hair-leash → master · +64 −15 · 1 files · 4 commits · merged 2026-11-27 05:51 UTC

Follows #444 (merged).

What the game does

The close-up strand simulation doesn't use a fixed pull toward the stored guide. It scales the pull's compliance by a leash:

c' = c · m · (R / |x − B|)^e

  • A point within R of its stored place is pulled less; one beyond R is pulled more.
  • R is the length of the point's rest offset, stored per segment in graphics header +0x3c (B3, the fourth byte / 600 m). Without B3 the game uses 4·a·c.
  • The exponent e = 3E/255, with E = header +0x70 byte 2. It is 1 or 2 on Mandy's pieces.
  • m = lo + 15·dt·(hi − lo), with lo and hi set by E.
  • In the bind pose the skinned offset length is the stored length, so the viewer can use B3 directly. There is medium confidence in exactly which lengths the game measures there.

What changed

  • SimData gains leash (R per point; 0 at roots) and leash_e. B3 holds one entry per segment, K − 1 per strand; checked against Mandy's three long pieces.
  • Groom::settle applies the leash to the pull. The step is the game's 30 fps substep (0.06 s), since m depends on it.

Checks

  • New unit test: R = 0 keeps a guide as stored, and a longer leash lets it hang further. All crate tests pass.
  • Mandy at the game-frame angles: the hair sits a little fuller at the sides and keeps more of its stored shape, closer to the game's width in the front frame. The shoulder drape from #444 is kept.
  • Lucia: unchanged apart from a slightly fuller ponytail.
**@⁠holdmysocks** on GitHub · 2026-11-27 04:43 UTC · [original](https://github.com/holdmysocks/SixNG/pull/457) `holdmysocks:people/hair-leash` → `master` · +64 −15 · 1 files · 4 commits · merged 2026-11-27 05:51 UTC Follows #444 (merged). ## What the game does The close-up strand simulation doesn't use a fixed pull toward the stored guide. It scales the pull's compliance by a leash: c' = c · m · (R / |x − B|)^e - A point within R of its stored place is pulled less; one beyond R is pulled more. - R is the length of the point's rest offset, stored per segment in graphics header +0x3c (B3, the fourth byte / 600 m). Without B3 the game uses 4·a·c. - The exponent e = 3E/255, with E = header +0x70 byte 2. It is 1 or 2 on Mandy's pieces. - m = lo + 15·dt·(hi − lo), with lo and hi set by E. - In the bind pose the skinned offset length is the stored length, so the viewer can use B3 directly. There is medium confidence in exactly which lengths the game measures there. ## What changed - `SimData` gains `leash` (R per point; 0 at roots) and `leash_e`. B3 holds one entry per segment, K − 1 per strand; checked against Mandy's three long pieces. - `Groom::settle` applies the leash to the pull. The step is the game's 30 fps substep (0.06 s), since m depends on it. ## Checks - New unit test: R = 0 keeps a guide as stored, and a longer leash lets it hang further. All crate tests pass. - Mandy at the game-frame angles: the hair sits a little fuller at the sides and keeps more of its stored shape, closer to the game's width in the front frame. The shoulder drape from #444 is kept. - Lucia: unchanged apart from a slightly fuller ponytail.
The viewer drew the guides as stored. The game runs its strand simulation
on them every frame, so on a still character the hair hangs under gravity
and drapes over the shoulders. Port the close-up simulation pass:

- read the groom's simulation inputs: per-point pull and bend compliance
  (graphics header B1), rest lengths (B2), the bend-constraint flag
  (header +0x50 bit 7) and the damping rate (system +0xF6)
- Groom::settle: gravity, the pull back to the stored shape with
  f = 1 / (1 + a c / dt^2), follow-the-leader rest lengths with the
  game's look-ahead, the bend constraint toward the stored segment
  angles (stiffened near colliders), and push-out of the body colliders,
  run to rest
- the viewer settles each groom before drawing; SIXNG_HAIR_NO_SIM=1
  keeps the stored guides for research

Left out: the leash scale on the pull (needs per-node pose data), the
point radius and extra damping set at run time, and wind.
The close-up strand simulation scales the pull's compliance by a leash:
c' = c m (R / |x - B|)^e. A point within R of its stored place is pulled
less, and one beyond it more. R is the length of the point's rest offset
in graphics header +0x3c (B3, the fourth byte / 600 m), or 4 a c without
B3. The exponent e = 3E/255 and the time scale m come from header +0x70
byte 2.

Read B3 and E into SimData and apply the leash in Groom::settle. The
step is now the game's substep at 30 fps (0.06 s), since m depends on it.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 04:47:51 +00:00
# Conflicts:
#	crates/sixng-core/src/groom.rs
github-bot changed target branch from master to gh-pr/457/base 2026-11-27 05:54:48 +00:00
github manually merged commit 718dcc687c into gh-pr/457/base 2026-11-27 05:54:49 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.