fixed tangent space
This commit is contained in:
parent
637195391d
commit
dcb95d1644
@ -367,6 +367,8 @@ void Mesh::computeTangents()
|
|||||||
|
|
||||||
glm::vec3 binormalDir = deltaUV1.x * edge2 - deltaUV2.x * edge1;
|
glm::vec3 binormalDir = deltaUV1.x * edge2 - deltaUV2.x * edge1;
|
||||||
binormalDir = glm::normalize(binormalDir*f);
|
binormalDir = glm::normalize(binormalDir*f);
|
||||||
|
if(glm::dot(glm::cross(normals[vertexId0], binormalDir), tangentDir) < 0.f)
|
||||||
|
binormalDir = -binormalDir;
|
||||||
|
|
||||||
tangents[vertexId0] = {tangentDir, binormalDir};
|
tangents[vertexId0] = {tangentDir, binormalDir};
|
||||||
tangents[vertexId1] = {tangentDir, binormalDir};
|
tangents[vertexId1] = {tangentDir, binormalDir};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user