diff options
| author | Kam471 <115741199+Kam471@users.noreply.github.com> | 2026-11-22 16:35:25 +0000 |
|---|---|---|
| committer | Kam471 <115741199+Kam471@users.noreply.github.com> | 2026-11-22 16:35:25 +0000 |
| commit | 8dea28d4e25ab7010bd394934f9cd2b783e5d874 (patch) | |
| tree | 2d544319f8ea1507402ac75fe9401b256fc5fa5b /docs | |
| parent | e20ced926276271a7f3e33c931995402db63a5d6 (diff) | |
docs: record the skinned GLB layout; fix per-component joint counts
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/character_skeleton.md | 41 |
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 |
| 186 | are higher because that recovery also walks nested archives. | 186 | are 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 | ||
| 193 | and then the ped table, and reads the 8-influence streams from the graphics buffer. The | ||
| 194 | section 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 | |||
| 209 | The output has one skin. Its joints are the full ped skeleton plus any drawable-local helper | ||
| 210 | joints 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 | ||
| 213 | normalised to 1.0. Bind and inverse-bind matrices use the same Z-up to Y-up conversion as | ||
| 214 | positions, `(x, y, z) -> (x, z, -y)`. | ||
| 215 | |||
| 216 | ```bash | ||
| 217 | python -I tools/skinned_glb.py out.glb \ | ||
| 218 | --skeleton <ped>/model.json \ | ||
| 219 | --component <head>/model.json \ | ||
| 220 | --component <jacket>/model.json | ||
| 221 | ``` | ||
| 222 | |||
| 223 | The measured head/jacket export uses 596 ped joints plus 107 garment helper joints (703 | ||
| 224 | total). This is a static-export skip: only the components named on the command line are | ||
| 225 | exported, and no body or other unrequested component is assembled. No game data or generated | ||
| 226 | GLB is stored in the repository; `tests/test_skinned_glb.py` builds its own skeleton, skin | ||
| 227 | buffer and GLB. | ||
| 228 | |||
| 188 | ## Texture parameter split | 229 | ## Texture parameter split |
| 189 | 230 | ||
| 190 | The character material blocks carry several 32-bit parameter hashes before each 64-bit asset | 231 | The character material blocks carry several 32-bit parameter hashes before each 64-bit asset |