You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Greetings. Thanks for your work on this extensive tutorial set. I think I may have found a problem with the code performing orthogonalization of the tangent and bitangent. First, it appeared that bitangent orthogonalization was left out altogether, while the tangent operation left off part of the required calculation. To fix it I added the following function to tangentspace.cpp
glm::vec3 proj(glm::vec3 u, glm::vec3 v) {
return u * (glm::dot(u, v) / glm::dot(u, u));
}
and modified the "Going Further" loop as follows:
...
t = glm::normalize(t - proj(n, t));
b = glm::normalize(b - proj(n, b) - proj(t, b));
...
Those two together will make TBN orthogonal and allow the inverse transpose. Please correct me if you find this in error. Thanks for your attention.
-B
The text was updated successfully, but these errors were encountered:
The formulas you're suggestion are indeed the full Gram-Schmidt formulas, and should be correct. However, I don't think the current implementation is broken (although I admit there's a tricky shortcut) :
By construction, t is orthogonal to n (line 37)
By construction, b is orthogonal to n (line 38)
The only missing part is that t should be orthogonal to b, too.
Line 61 does just that.
Do you have a case where this breaks ?
Sincerely,
Arnaud
Nope, I don't. I just couldn't figure out what you were doing, which kinda of defeats the purpose of a tutorial.
And I still don't quite follow how line 61 makes t orthogonal to b. Looking at one of the references you mentioned: Lengyel’s Method. That line seems to match the first part of the projection process, but the second is missing, hence my addition. Could you explain in a bit more detail for me?
Greetings. Thanks for your work on this extensive tutorial set. I think I may have found a problem with the code performing orthogonalization of the tangent and bitangent. First, it appeared that bitangent orthogonalization was left out altogether, while the tangent operation left off part of the required calculation. To fix it I added the following function to tangentspace.cpp
glm::vec3 proj(glm::vec3 u, glm::vec3 v) {
return u * (glm::dot(u, v) / glm::dot(u, u));
}
and modified the "Going Further" loop as follows:
...
t = glm::normalize(t - proj(n, t));
b = glm::normalize(b - proj(n, b) - proj(t, b));
...
Those two together will make TBN orthogonal and allow the inverse transpose. Please correct me if you find this in error. Thanks for your attention.
-B
The text was updated successfully, but these errors were encountered: