Renormalize normals & tangents from dmap .glb import

This commit is contained in:
Robert Beckebans 2022-09-26 11:50:29 +02:00
parent 0b677fe752
commit d8aba3e850

View file

@ -164,6 +164,10 @@ MapPolygonMesh* MapPolygonMesh::ConvertFromMeshGltf( const gltfMesh_Primitive* p
normal.z = vec.z;
normal *= transform;
// renormalize because previous transforms may contain scale operations
normal.Normalize();
mesh->verts[i].SetNormal( normal );
}
@ -208,6 +212,7 @@ MapPolygonMesh* MapPolygonMesh::ConvertFromMeshGltf( const gltfMesh_Primitive* p
tangent.z = vec.z;
tangent *= transform;
tangent.Normalize();
mesh->verts[i].SetTangent( tangent );
mesh->verts[i].SetBiTangentSign( vec.w );