-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tangent space computation is under-specified #1367
Comments
Tehre's also the issue that even if you have normal, you may not have tangent and/or need to recompute the tangent vectors. This redirect you to Appendix A, that is still a TODO. Should something about recalculating TANGENT vertex attribute, because there's an infinite number of tangents to a surface. All I know is that common practice is to align TANGENT and BITANGENT (BINORMAL) with the UV plane. |
The glTF spec does specify the format of the normal maps though:
I tried to spell out the implications of that in this comment: mrdoob/three.js#11438 (comment) |
Thanks @emackey, I will read through that carefully when I'll have some time! 😄 |
When tangents are missing, the engines should generate them using MikkTSpace algorithms based on the positions, normals, and texture coordinates present. Bitangent vectors are always computed as a cross product of normals and tangents multiplied by the tangent's W component. Any issues with particular implementations should be reported to their repos. |
Reference: KhronosGroup/glTF-Sample-Models#174
When you have engine-computed normals, the spec says that the application should use the "default MikkTSpace algorithms", but I have run into issues where MikkTSpace and the reference code for generating tangents do not match in the W component.
The issue which needs to be clarified is:
What is the inferred bi-tangent sign when loading a model which does not have tangents? The reference PBR shaders seem to suggest that W is always 1 (i.e. B = cross(N, T)), but that disagrees with MikkTSpace output in many cases.
In general, I would like to see tangent-generating better specified when TANGENT accessors do not exist.
The text was updated successfully, but these errors were encountered: