sixng outfit: a character as one rigged GLB with an animation clip; ped skin fixes #12

Closed
github-bot wants to merge 7 commits from gh-pr/12/head into gh-pr/12/base
Owner

@⁠Ahmet-Dedeler on GitHub · 2026-11-22 17:42 UTC · original
Ahmet-Dedeler:feat/outfit-glb → master · +1813 −339 · 12 files · 7 commits · closed without merging

Ped clothing was exported with one skeleton copy per part, and heads, jackets and pants had no skin at all. This change puts a character's outfit on one skeleton in one GLB, which imports into Blender as a single armature. It can also apply a clip from anim.rpf.

Ped skin

  • Helper bones now hang under the body bone their record names (+0x2C), so they follow the body. On a sports top, the median distance from a helper to the vertices it moves went from 0.36 m to 0.07 m.
  • Heads and jackets (format 0x8C, joint in the low 12 bits) are now skinned. Before, the high bits threw off 26% of influences.
  • Every bone array of a part is used. The biker jacket has five, which accounts for most of the "cloth bone" parts.
  • A palette with some unknown bones is still applied; only the unknown weights move.
  • Skins are valid glTF: the clothing GLB goes from 1 error and 343 warnings in the Khronos validator to 0 errors.

sixng clips

  • Decodes anim.rpf clip dictionaries: 61,506 of 61,506 with 0 errors (316,150 clips).
  • Ported from rage9-re (MIT/Apache, credited in the module header and THIRD_PARTY_NOTICES.md).

sixng outfit <char> [--parts|--add] [--clip <dict>/<clip>] -o x.glb

  • Joint lists are merged by name and every part's vertex joints are remapped.
  • The clip becomes a glTF animation, matched by joaat(bone name).
  • export.rs: drawable decoding is split out of export_entry and rebased on #8. Member exports are byte-identical before and after the split (18 GLBs plus model.json compared, including a dictionary and one of its members).

Checked on player_story000_00, player_story000_01, cs_raul, cs_iris and u_m_m_farm_monster_man, with walk clips:

Check Result
Khronos validator 0 errors
Blender 5.2 import 1 armature (744–917 bones)
Rest-pose skinning vs stored vertices ≤ 3e-7 m
Clip bone tracks landing on joints 95.6%
Bone length change, rotation-only joints ≤ 4e-7 m
  • Tests: synthetic unit tests for the joint merge, the GLB structure and one animation channel. outfit_real runs when SIXNG_GAME/SIXNG_WORK are set.
  • The index version is 5 now (from upstream), so older work folders need a re-index.

Known limits

  • One field jacket (farm_monster_man) names 16 bones that exist nowhere I could find. Their 2,161 weights are moved to neighbouring bones; it looks right, but that is a visual check only.
  • Not included: root motion, facial animation, hair and cloth simulation.
  • Outfit part selection moved into core. A head with a baked-in earring is now its own group, which fixes cs_raul exporting with no head.
**@⁠Ahmet-Dedeler** on GitHub · 2026-11-22 17:42 UTC · [original](https://github.com/holdmysocks/SixNG/pull/12) `Ahmet-Dedeler:feat/outfit-glb` → `master` · +1813 −339 · 12 files · 7 commits · closed without merging Ped clothing was exported with one skeleton copy per part, and heads, jackets and pants had no skin at all. This change puts a character's outfit on one skeleton in one GLB, which imports into Blender as a single armature. It can also apply a clip from `anim.rpf`. **Ped skin** - Helper bones now hang under the body bone their record names (+0x2C), so they follow the body. On a sports top, the median distance from a helper to the vertices it moves went from 0.36 m to 0.07 m. - Heads and jackets (format 0x8C, joint in the low 12 bits) are now skinned. Before, the high bits threw off 26% of influences. - Every bone array of a part is used. The biker jacket has five, which accounts for most of the "cloth bone" parts. - A palette with some unknown bones is still applied; only the unknown weights move. - Skins are valid glTF: the clothing GLB goes from 1 error and 343 warnings in the Khronos validator to 0 errors. **`sixng clips`** - Decodes `anim.rpf` clip dictionaries: 61,506 of 61,506 with 0 errors (316,150 clips). - Ported from rage9-re (MIT/Apache, credited in the module header and `THIRD_PARTY_NOTICES.md`). **`sixng outfit <char> [--parts|--add] [--clip <dict>/<clip>] -o x.glb`** - Joint lists are merged by name and every part's vertex joints are remapped. - The clip becomes a glTF animation, matched by joaat(bone name). - `export.rs`: drawable decoding is split out of `export_entry` and rebased on #8. Member exports are byte-identical before and after the split (18 GLBs plus `model.json` compared, including a dictionary and one of its members). **Checked** on player_story000_00, player_story000_01, cs_raul, cs_iris and u_m_m_farm_monster_man, with walk clips: | Check | Result | |---|---| | Khronos validator | 0 errors | | Blender 5.2 import | 1 armature (744–917 bones) | | Rest-pose skinning vs stored vertices | ≤ 3e-7 m | | Clip bone tracks landing on joints | 95.6% | | Bone length change, rotation-only joints | ≤ 4e-7 m | - Tests: synthetic unit tests for the joint merge, the GLB structure and one animation channel. `outfit_real` runs when `SIXNG_GAME`/`SIXNG_WORK` are set. - The index version is 5 now (from upstream), so older work folders need a re-index. **Known limits** - One field jacket (farm_monster_man) names 16 bones that exist nowhere I could find. Their 2,161 weights are moved to neighbouring bones; it looks right, but that is a visual check only. - Not included: root motion, facial animation, hair and cloth simulation. - Outfit part selection moved into core. A head with a baked-in earring is now its own group, which fixes cs_raul exporting with no head.
Ped clothing helper bones (GM_U01_*) are roots of the drawable's own
skeleton; their bone record names the parent in the shared ped skeleton
(u32 joaat at +0x2C, read as Bone::parent_hash). They now hang under that
bone with their parent-relative bind moved to model space (and posed with
the body shape), so they follow the body. Sports top: helper joints 0.36 m
-> 0.07 m median from the weighted centroid of the vertices they drive.

Heads: slots 8/9 format 0x8c (4 x u32 per vertex, joint in the low u16)
decode as 8-influence blend indices, and drawables without a skeleton of
their own whose palette names shared ped bones are bound to the shared
skeleton (also low-detail clothing copies).

glTF: zero-weight influences point at joint 0 and skin.skeleton is only
written when there is one joint root. The sports top GLB goes from 1 error
+ 343 warnings to 0 errors in the Khronos validator.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
build_drawable decodes a drawable's meshes, skin and materials (texture
URIs relative to a given folder) so other exporters can reuse it;
export_entry keeps writing the files. Output is byte-identical on the
sample ped parts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ped parts can hold several bone arrays (torso, upper-arm, forearm helper
sets); find_skeletons returns all of them and ped parts use them all as
their own joints, so palette bones of the later arrays resolve (biker
jacket: 40 palette bones that were in neither skeleton now bind; pants
16). The 0x8c skin streams keep the joint index in the low 12 bits only;
bits 12-15 and the high u16 of stream 8 hold other data (jacket: 0 of
82,042 weighted influences fall outside the palette with the mask, 26 %
without). Jackets and pants with 0x8c streams were exported unskinned
before the previous commit; now 0 unresolved influences and 0 validator
errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
With the shared skeleton loaded, a palette that names any known bone is
now used; unknown bones get no joint and their weight moves to the other
influences (warning with the hashes). Before, a palette under 90 % known
was skipped and the vertex joints were read as skeleton indices, which
bound whole meshes to unrelated bones: u_m_m_farm_monster_man's field
jacket (16 of 118 palette bones unknown) came out skinned to the legs,
median 0.5-0.9 m from its vertices to their main joint per mesh; now 0.06-0.09 m.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
mesh_glb_with takes GlbOptions: animation channels for skeleton joints
(RAGE-space values converted to Y-up, quaternions normalised, one time
accessor per distinct key set), joint nodes as translation / rotation /
scale (glTF only animates TRS nodes; decompose() splits the local
matrices), and skinned mesh nodes at the scene root (glTF ignores their
parent transforms; avoids NODE_SKINNED_MESH_NON_ROOT). mesh_glb is
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
New module anim: clip dictionaries, clips, animations and the sequence
block codecs (static, quantised, lookup-table and 64-frame delta-curve
channels, quaternion rebuild), ported from rage9-re by Ahmet Dedeler
(MIT OR Apache-2.0, credited in the module and THIRD_PARTY_NOTICES).
clip_tracks puts a clip's bone tracks on the clip's time line (binding
window and rate). Large dictionaries continue past the first system
page into the next stream; all streams are joined.

`sixng clips [--name <regex>]` lists the clip dictionaries by name (the
first run reads every resource of the anim.rpf index once, ~20 s, and
caches the names in index/anim.clipdicts.json); `sixng clips <dict>`
lists its clips with duration, track and bone counts.

Census (examples/clipcensus, all of anim.rpf): 61,506 of 61,506
dictionaries decode with 0 errors (every delta curve lands on its next
anchor); 316,150 clips, 294,822 of them bind animations; 191,031
animations, 12.68 M tracks. Before joining the streams, 1 in 16
dictionaries failed on block pointers past the first page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`sixng outfit <character> [--parts|--add <regex,…>] [--clip <dict>/<clip>]
-o out.glb` exports a character's outfit parts (the GUI's default look,
or the parts named) as ONE GLB with ONE skin. Each part is built with
export::build_drawable (shared ped skeleton + its own helper bones);
outfit::merge_skeletons merges the joint lists by name (a helper two
parts define differently is kept twice, the second as <name>.<part>) and
remap_joints points every vertex at the merged list. A clip becomes a
glTF animation: bone tracks drive the joint whose joaat(lowercase name)
is the track's bone id; mover and float tracks are left out. The JSON
report gives per part vertices, joints and unbound weighted influences,
and for the clip how many bone tracks land on a joint.

Part selection (outfit_prefix, outfit_options …) moves from the GUI's
assemble.rs to sixng_core::outfit so the CLI can use it; heads with an
earring baked in get their own group so the plain head is the default
(cs_raul exported no head before).

Checked on player_story000_00 / _01, cs_raul, cs_iris and
u_m_m_farm_monster_man with female / male walk clips: Khronos validator 0
errors; Blender 5.2 imports 1 armature (744-917 bones) with every skinned
mesh on it; rest-pose skinning = stored vertices within 3e-7 m (Blender
1.2e-7 m); 152 of 159 clip bone tracks (95.6 %) land on a joint; joints
without an animated translation keep their length within 4e-7 m over the
clip. Tests: merge/remap and GLB structure on synthetic joints; a real
outfit + clip behind SIXNG_GAME / SIXNG_WORK (ignored by default).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:03:01 +00:00
github-bot closed this pull request 2026-11-26 20:03:01 +00:00
Author
Owner

@⁠holdmysocks on GitHub · 2026-11-22 19:17 UTC · original

Thanks! Squash-merged into master as d207a54 (CI had passed on all three platforms). The credit line in anim.rs now points to THIRD_PARTY_NOTICES.md, which keeps the MIT notice.

**@⁠holdmysocks** on GitHub · 2026-11-22 19:17 UTC · [original](https://github.com/holdmysocks/SixNG/pull/12#issuecomment-7084265516) Thanks! Squash-merged into master as d207a54 (CI had passed on all three platforms). The credit line in anim.rs now points to THIRD_PARTY_NOTICES.md, which keeps the MIT notice.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.