Skip to content

Commit

Permalink
Merge pull request #88931 from clayjohn/GLTF-normals
Browse files Browse the repository at this point in the history
Fix wrong indexing when generating dummy tangents in GLTF import
  • Loading branch information
akien-mga committed Feb 27, 2024
2 parents 2a05632 + 14c776f commit ac43768
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2796,7 +2796,7 @@ Error GLTFDocument::_parse_meshes(Ref<GLTFState> p_state) {

Vector<Vector3> normals = array[Mesh::ARRAY_NORMAL];
for (int k = 0; k < vertex_num; k++) {
Vector3 tan = Vector3(normals[i].z, -normals[i].x, normals[i].y).cross(normals[k].normalized()).normalized();
Vector3 tan = Vector3(normals[k].z, -normals[k].x, normals[k].y).cross(normals[k].normalized()).normalized();
tangentsw[k * 4 + 0] = tan.x;
tangentsw[k * 4 + 1] = tan.y;
tangentsw[k * 4 + 2] = tan.z;
Expand Down

0 comments on commit ac43768

Please sign in to comment.