upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorKam471 <115741199+Kam471@users.noreply.github.com>2026-11-22 16:35:25 +0000
committerKam471 <115741199+Kam471@users.noreply.github.com>2026-11-22 16:35:25 +0000
commit8dea28d4e25ab7010bd394934f9cd2b783e5d874 (patch)
tree2d544319f8ea1507402ac75fe9401b256fc5fa5b /docs
parente20ced926276271a7f3e33c931995402db63a5d6 (diff)
docs: record the skinned GLB layout; fix per-component joint counts
Diffstat (limited to 'docs')
-rw-r--r--docs/character_skeleton.md41
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/character_skeleton.md b/docs/character_skeleton.md
index 489a21c94..759340aa4 100644
--- a/docs/character_skeleton.md
+++ b/docs/character_skeleton.md
@@ -185,6 +185,47 @@ recovery with the bone-palette pull requests applied, was posted in
185#634](https://github.com/ItsNotRexed/Leonida/issues/634#issuecomment-7074504326); the counts there 185#634](https://github.com/ItsNotRexed/Leonida/issues/634#issuecomment-7074504326); the counts there
186are higher because that recovery also walks nested archives. 186are higher because that recovery also walks nested archives.
187 187
188## Skinned GLB export
189
190`tools/skinned_glb.py` writes one skinned glTF 2.0 binary from a decoded ped skeleton
191`model.json` and one or more decoded drawable directories. It reads the drawable's palette
192(`grmModel + 0x20`), maps each palette hash through the drawable's own skeleton/string table
193and then the ped table, and reads the 8-influence streams from the graphics buffer. The
194section offsets are also in `drawable.buffers[vertex_buffer].mesh_blob.sections` as
195`[semantic, offset, format]`; the 23-word mesh-block header encodes
196`offset = (word >> 8) * 2`, `format = word & 0xFF`.
197
198| Component | Slot | Stream | Offset | Format | Bytes |
199|---|---|---:|---:|---:|---:|
200| head | 8 | `JOINTS_0`, 4 x u8 | 215,720 | `0x25` | 35,932 |
201| head | 9 | `JOINTS_1`, 4 x u8 | 251,652 | `0x25` | 35,932 |
202| head | 6 | `WEIGHTS_0`, 4 x u8 UNORM | 143,856 | `0x26` | 35,932 |
203| head | 7 | `WEIGHTS_1`, 4 x u8 UNORM | 179,788 | `0x26` | 35,932 |
204| jacket | 8 | `JOINTS_0` | 275,032 | `0x25` | 39,272 |
205| jacket | 9 | `JOINTS_1` | 314,304 | `0x25` | 39,272 |
206| jacket | 6 | `WEIGHTS_0` | 196,488 | `0x26` | 39,272 |
207| jacket | 7 | `WEIGHTS_1` | 235,760 | `0x26` | 39,272 |
208
209The output has one skin. Its joints are the full ped skeleton plus any drawable-local helper
210joints named by the palette; a palette hash that resolves nowhere is emitted as
211`bone_0x........`, never given an invented name. Every vertex keeps all eight influences as
212`JOINTS_0`/`JOINTS_1` and `WEIGHTS_0`/`WEIGHTS_1`. The source u8 weights sum to 255 and are
213normalised to 1.0. Bind and inverse-bind matrices use the same Z-up to Y-up conversion as
214positions, `(x, y, z) -> (x, z, -y)`.
215
216```bash
217python -I tools/skinned_glb.py out.glb \
218 --skeleton <ped>/model.json \
219 --component <head>/model.json \
220 --component <jacket>/model.json
221```
222
223The measured head/jacket export uses 596 ped joints plus 107 garment helper joints (703
224total). This is a static-export skip: only the components named on the command line are
225exported, and no body or other unrequested component is assembled. No game data or generated
226GLB is stored in the repository; `tests/test_skinned_glb.py` builds its own skeleton, skin
227buffer and GLB.
228
188## Texture parameter split 229## Texture parameter split
189 230
190The character material blocks carry several 32-bit parameter hashes before each 64-bit asset 231The character material blocks carry several 32-bit parameter hashes before each 64-bit asset