bigwheels
bigwheels copied to clipboard
[glTF] Calculate tangents if not provided
Using scene::GltfLoader
, some models in 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:
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: