glb_skinning: accept extra inverse bind matrices #1753

Merged
leonida/mandy
kirigayakazima merged 2 commits from codex/glb-skinning-surplus-bind-matrices into main 2026-11-28 14:57:09 +00:00

Pull request successfully merged and closed

kirigayakazima commented 2026-11-25 11:14:39 +00:00

Claimed in the coordination issue as: GLB-SKINNING-SURPLUS-BIND-MATRICES

What and why

The validator rejected every difference between the joint count and the accessor count. glTF permits an accessor to contain more matrices than a skin uses. The validator now rejects an undersized accessor, reports the actual count and retains its affine checks for the matrices used by joints. The synthetic case shares one accessor between two skins. glTF 2.0 skin specification

Tested

With one three-matrix accessor shared by skins of two joints and one joint, the baseline CLI exited 1 with two count errors. The branch exits 0 and its JSON retains both joint counts and the accessor count. The short-accessor and non-affine joint regressions also pass.

  • python -I tests/test_glb_skinning.py passed all 27 tests on this branch (Windows, Python 3.14.7).
  • git diff --check and the repository game-data scan of all changed paths passed.
  • The five independent changes were also merged locally. Both affected test files passed together (50 tests) and the three character-model consumer suites passed (28 tests). The shared base at bcaa13da passed 6,287 semantic tests across 488 files.

GPUs tested: N/A (CPU-only asset tooling).
AI-assisted: Yes.

Checklist

  • Based on current upstream main.
  • One topic.
  • Only synthetic test fixtures. No game data, keys or decryption.
  • Translator contract table: N/A.
Claimed in the coordination issue as: [GLB-SKINNING-SURPLUS-BIND-MATRICES](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7160621714) ### What and why The validator rejected every difference between the joint count and the accessor count. glTF permits an accessor to contain more matrices than a skin uses. The validator now rejects an undersized accessor, reports the actual count and retains its affine checks for the matrices used by joints. The synthetic case shares one accessor between two skins. [glTF 2.0 skin specification](https://github.com/KhronosGroup/glTF/blob/main/specification/2.0/Specification.adoc#skins) ### Tested With one three-matrix accessor shared by skins of two joints and one joint, the baseline CLI exited 1 with two count errors. The branch exits 0 and its JSON retains both joint counts and the accessor count. The short-accessor and non-affine joint regressions also pass. - `python -I tests/test_glb_skinning.py` passed all 27 tests on this branch (Windows, Python 3.14.7). - `git diff --check` and the repository game-data scan of all changed paths passed. - The five independent changes were also merged locally. Both affected test files passed together (50 tests) and the three character-model consumer suites passed (28 tests). The shared base at `bcaa13da` passed 6,287 semantic tests across 488 files. GPUs tested: N/A (CPU-only asset tooling). AI-assisted: Yes. ### Checklist - [x] Based on current upstream main. - [x] One topic. - [x] Only synthetic test fixtures. No game data, keys or decryption. - Translator contract table: N/A.
lixonik reviewed 2026-11-25 11:20:01 +00:00
lixonik left a comment
No description provided.
Independent check at "cdf5bce4". Windows: all 27 skinning tests passed. The relaxed count is correct for valid surplus matrices. A separate CLI check found that it also accepts a surplus matrix with an invalid fourth row. Details inline. AI-assisted review and CPU-only testing with synthetic inputs.
kirigayakazima reviewed 2026-11-27 12:09:50 +00:00
lixonik reviewed 2026-11-27 15:50:27 +00:00
lixonik left a comment
No description provided.
Re-verified at `783d1e61e` (merged cleanly onto `main` `ec91d695c`). - Confirmed the prior finding is resolved: `_validate_skins()` now validates the affine fourth row `[0, 0, 0, 1]` across all entries of `inverseBindMatrices`, including surplus matrices beyond `len(joints)`, with regression coverage for both valid shared surplus matrices and a non-affine surplus entry. - Windows 11, Python 3.12: `python -I -B tests/test_glb_skinning.py -v` passed (28/28); `scripts/check_no_game_data.py` and `git diff --check` clean. - No remaining findings. AI-assisted.
zmasi commented 2026-11-28 11:53:12 +00:00

#1753 | head 783d1e61e52de26334a8dc97f1cf953fe590964a (merged cleanly with main 24549bdb1) | python -I tests/test_glb_skinning.py | red on main: FAILED (failures=3) (inverseBindMatrices count 3 != joint count 2 rejected shared surplus matrices) | green on PR+main: 34 tests OK | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited _validate_skins in tools/glb_skinning.py and docs/character_skeleton.md (accepting inverseBindMatrices accessors with count >= len(joints) while still validating finite elements and the affine [0, 0, 0, 1] fourth row across every matrix in the accessor, including surplus entries). Also verified clean merge (0 conflicts) and combined execution with #1754 (36 tests OK), plus tests/test_docs_encoding.py (1 OK), tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

#1753 | head 783d1e61e52de26334a8dc97f1cf953fe590964a (merged cleanly with main 24549bdb1) | `python -I tests/test_glb_skinning.py` | red on main: `FAILED (failures=3)` (`inverseBindMatrices count 3 != joint count 2` rejected shared surplus matrices) | green on PR+main: `34 tests OK` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `_validate_skins` in `tools/glb_skinning.py` and `docs/character_skeleton.md` (accepting `inverseBindMatrices` accessors with `count >= len(joints)` while still validating finite elements and the affine `[0, 0, 0, 1]` fourth row across every matrix in the accessor, including surplus entries). Also verified clean merge (`0` conflicts) and combined execution with #1754 (`36 tests OK`), plus `tests/test_docs_encoding.py` (`1 OK`), `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`.
MoonEyes commented 2026-11-28 14:57:06 +00:00

Red/green: pytest tests/test_glb_skinning.py fails on main (1 failed, 5 passed, 4 subtests passed) and passes on head 783d1e61e52d merged with main (28 passed, 23 subtests passed).
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

Red/green: `pytest tests/test_glb_skinning.py` fails on main (1 failed, 5 passed, 4 subtests passed) and passes on head 783d1e61e52d merged with main (28 passed, 23 subtests passed). Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No description provided.