[glTF] Calculate tangents if not provided
- Dominant language
- C++
- Stars
- 107
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
Using `scene::GltfLoader`, some models in [glTF-Sample-Assets](https://github.com/KhronosGroup/glTF-Sample-Assets) do not render correctly since the `TANGENT` primitive attribute is missing.
Currently, if tangents are not present then the tangent will be set to `{0, 0, 0, 0}`; normal maps won't be rendered correctly.
From [3.7.2.1](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#meshes-overview):
> When tangents are not specified, client implementations SHOULD calculate tangents using default MikkTSpace algorithms with the specified vertex positions, normals, and texture coordinates associated with the normal texture.
This would allow us to render more models correctly like:
- [ABeautifulGame](https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/ABeautifulGame)
- [AntiqueCamera](https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/AntiqueCamera)
- [DamagedHelmet](https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/DamagedHelmet)
Contributor guide
Assessment
This issue has not been assessed yet.