Open baslack opened 6 years ago
Hi Baslack, thanks for your feedback.
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) :
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?
-B
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