-
I'm having some trouble with the All of the other polygons look fine except these on the back of the couch. If I recalculate the bitangent by crossing the normal and tangent, the issue goes away entirely. While doing that fixes the problem, I'm concerned that I'm just sweeping a problem under the rug that will later show up as something nastier. Here is the mesh file I'm loading in for diagnostics purposes: Edit: sorry, here is another version of the couch with less junk in the scene: If anyone has any idea why this is happening, or how I can fix it, please let me know. I'm assuming there is not much I could be doing wrong here because everything else is working, but please let me know if you can think of anything I should check. Thanks! Edit: One strange thing I noticed was that this polygon has the hidden edge being flipped at some point between Blender and export. I think the retriangulation may be flipping the hidden edge, but why? Even stranger, if I run the triangulation modifier in Blender, it will also flip this hidden edge. Any ideas why everything wants to flip this polygon's edge? Or why Blender doesn't flip it before triangulation? It seems to be the only polygon that experiences this strangeness. And I've worked with hundreds of models in the past without seeing this. I don't know if this is related to the issue, but it is a strange coincidence if not. Edit2: Well, that hidden edge being flipped had nothing to do with the issue. I tried disabling triangulation on export, which resulted in the edge remaining as it was, but the problem still remained. I also rendered another image for debugging. This render is of pure bitangents. In this image, I'm rendering the bitangent vectors exactly as they come from assimp, but with Edit3: I completely remapped the model UVs, thinking that something strange may have happened to that polygon, and for whatever reason, the problem went away. Still not really sure what happened there. I think I'm going to add a debugging test to my game engine that checks for bitangents not being equal (enough) to the cross of the normal and tangent, to help detect this type of issue in the future. If anyone has any idea what happened in my UVs that caused this, I would love to know! Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Even with the updated UVs, I am getting some strange results from assimp's bitangent. Am I correct in assuming it should be very close to the cross product of the normal and tangent? Here is a printout of the data from one of the subsets. Many of the bitangents are very close to the cross product, but some are completely parallel to it. Can anyone explain why this happens? Should bitangents not be orthogonal to the normal and tangent?
|
Beta Was this translation helpful? Give feedback.
-
Well, I learned something after some research. Tangent vectors do not necessarily need to be orthogonal or perpendicular to each other. However, if they are not, it usually means your mesh UVs are not aligned very well with the texels of the UV space. But this sort of thing happens sometimes, such as on the corners of complex shapes, where you didn't want to add an extra UV seam. The U of one vertex may be perfectly horizontal, while its V is not perfectly vertical. So I thought I would share that, in case anyone runs into this post for the same reasons. Most likely, you need to figure out which vertices are non-orthogonal and inspect that area of the mesh. In most scenarios, it probably just needs relaxed or another seam added. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot for sharing the information. |
Beta Was this translation helpful? Give feedback.
-
In general, tangents and bitangents are not orthogonal. I have written a rather lengthy explanation in Q&A #5512 . I see the same kind of artefacts in the Sponza model after that commit, see here: The problem on the floor was not present before ad766cb: |
Beta Was this translation helpful? Give feedback.
Well, I learned something after some research. Tangent vectors do not necessarily need to be orthogonal or perpendicular to each other. However, if they are not, it usually means your mesh UVs are not aligned very well with the texels of the UV space. But this sort of thing happens sometimes, such as on the corners of complex shapes, where you didn't want to add an extra UV seam. The U of one vertex may be perfectly horizontal, while its V is not perfectly vertical.
So I thought I would share that, in case anyone runs into this post for the same reasons. Most likely, you need to figure out which vertices are non-orthogonal and inspect that area of the mesh. In most scenarios, it probably …