glb_skinning: accept extra inverse bind matrices #1753

Open
github-bot wants to merge 2 commits from github-bot/gh-1753 into main AGit
Owner

@⁠kirigayakazima on GitHub · 2026-11-25 11:14 UTC · original
kirigayakazima:codex/glb-skinning-surplus-bind-matrices → main · +35 −9 · 3 files · 2 commits · open

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.
**@⁠kirigayakazima** on GitHub · 2026-11-25 11:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1753) `kirigayakazima:codex/glb-skinning-surplus-bind-matrices` → `main` · +35 −9 · 3 files · 2 commits · open Claimed in the coordination issue as: [GLB-SKINNING-SURPLUS-BIND-MATRICES](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:03:44 +00:00
Author
Owner

@⁠lixonik on GitHub · 2026-11-25 11:20 UTC · original · reviewed

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.

**@⁠lixonik** on GitHub · 2026-11-25 11:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1753#pullrequestreview-6056673280) · **reviewed** 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.
@ -489,3 +489,3 @@
"normalized": meta["normalized"],
})
if meta["count"] != len(joints):
if meta["count"] < len(joints):
Author
Owner

@⁠lixonik on GitHub · 2026-11-25 11:20 UTC · original

Accepting surplus matrices is correct, but the affine check below only covers indices below the joint count. With a two-joint synthetic model and a three-matrix accessor, I changed the third matrix's fourth row to [0.5, 0, 0, 1]. The CLI exited 0 and reported no errors. Now that excess entries are accepted, could the fourth-row check cover the entire referenced accessor? glTF requires the affine fourth row on each matrix. glTF 2.0 skin specification

**@⁠lixonik** on GitHub · 2026-11-25 11:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1753#discussion_r4694123506) Accepting surplus matrices is correct, but the affine check below only covers indices below the joint count. With a two-joint synthetic model and a three-matrix accessor, I changed the third matrix's fourth row to [0.5, 0, 0, 1]. The CLI exited 0 and reported no errors. Now that excess entries are accepted, could the fourth-row check cover the entire referenced accessor? glTF requires the affine fourth row on each matrix. [glTF 2.0 skin specification](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#skins)
@ -489,3 +489,3 @@
"normalized": meta["normalized"],
})
if meta["count"] != len(joints):
if meta["count"] < len(joints):
Author
Owner

@⁠kirigayakazima on GitHub · 2026-11-27 12:09 UTC · original

Fixed: removed and index < len(joints) in tools/glb_skinning.py so every entry in inverseBindMatrices (including surplus entries) is checked for an affine fourth row [0, 0, 0, 1]. Updated tests/test_glb_skinning.py to test affine-valid shared surplus matrices plus rejecting an invalid surplus fourth row (inverseBindMatrices[2]).

**@⁠kirigayakazima** on GitHub · 2026-11-27 12:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1753#discussion_r4719193459) Fixed: removed `and index < len(joints)` in `tools/glb_skinning.py` so every entry in `inverseBindMatrices` (including surplus entries) is checked for an affine fourth row `[0, 0, 0, 1]`. Updated `tests/test_glb_skinning.py` to test affine-valid shared surplus matrices plus rejecting an invalid surplus fourth row (`inverseBindMatrices[2]`).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1753/head:github-bot/gh-1753'
git switch 'github-bot/gh-1753'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1753'
git switch 'github-bot/gh-1753'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1753'
git switch 'github-bot/gh-1753'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1753'
git switch 'main'
git merge --squash 'github-bot/gh-1753'
git switch 'main'
git merge --ff-only 'github-bot/gh-1753'
git switch 'main'
git merge 'github-bot/gh-1753'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.