Skip to content

[rmodels] Use inverse bind matrices when possible for bind pose in gltf loader#5832

Merged
raysan5 merged 1 commit into
raysan5:masterfrom
fyl2xp1:inverse_bind_matrix
Jun 5, 2026
Merged

[rmodels] Use inverse bind matrices when possible for bind pose in gltf loader#5832
raysan5 merged 1 commit into
raysan5:masterfrom
fyl2xp1:inverse_bind_matrix

Conversation

@fyl2xp1
Copy link
Copy Markdown
Contributor

@fyl2xp1 fyl2xp1 commented May 2, 2026

Trying to fix an edge case I've encountered when loading gltf models that provide inverseBindMatrices. Right now raylib ignores them and derives bindPose from the skeleton node hierarchy, which differs in this case.
This patch derives bindPose from inverseBindMatrices when possible, and falls back to the existing path if they aren't provided by the model being loaded.

Tested on Windows using MSVC. Loads both a previously improperly handled model, and a previously working model.

@raysan5 raysan5 changed the title Use inverse bind matrices when possible for bind pose in gltf loader [rmodels] Use inverse bind matrices when possible for bind pose in gltf loader May 3, 2026
@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented May 3, 2026

@fyl2xp1 Please, could you provide some model for testing those changes? Thanks!

@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented May 3, 2026

@JeffM2501 What do you think about this change?

@JeffM2501
Copy link
Copy Markdown
Contributor

@JeffM2501 What do you think about this change?

Seems like a good change to me.

@fyl2xp1
Copy link
Copy Markdown
Contributor Author

fyl2xp1 commented May 4, 2026

ctm_sas.zip
Here is the model that was broken

@fyl2xp1
Copy link
Copy Markdown
Contributor Author

fyl2xp1 commented May 28, 2026

Bump

@kimkulling
Copy link
Copy Markdown
Contributor

I will have a look.

@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented May 30, 2026

@kimkulling thank you very much Kim!

@kimkulling
Copy link
Copy Markdown
Contributor

Looks fine for me.

@raysan5 raysan5 merged commit ca46387 into raysan5:master Jun 5, 2026
@raysan5
Copy link
Copy Markdown
Owner

raysan5 commented Jun 5, 2026

@fyl2xp1 thanks for the improvement and thanks @JeffM2501 @kimkulling for the further review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants