Skip to content

[rmodels] Fix and improve GenMeshTangents #4937

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025

Conversation

Bigfoot71
Copy link
Contributor

I propose a nearly complete review of GenMeshTangents, which had several issues

Here is the list of changes:

  • Support for indexed meshes (mesh->indices)
  • Correct accumulation of tangents/bitangents per vertex
  • Improved handling of degenerate cases (invalid UVs, null tangents -> fallback to orthogonal)
  • More robust orthogonalization (Gram-Schmidt with fallback in case of collinearity)
  • Bonus, some comments

The function was tested with R3D, here is a quick example "before / after" with IBL:

screenshot000

screenshot000

@raysan5 raysan5 merged commit ba31219 into raysan5:master May 13, 2025
15 checks passed
@raysan5
Copy link
Owner

raysan5 commented May 13, 2025

@Bigfoot71 Thanks for the improvement! That function has already gone through several redesigns and the truth is that it was not properly tested... Thanks!

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.

2 participants