-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
GLTFExporter: Normal Texture handedness #14723
Comments
Related: #13784 (comment) and the ensuing thread. |
@WestLangley Thanks for the reference. Missed that. Some investigation from my side if it helps: I tried flipping UVs in processMesh() of the exporter and turning off the flipY condition in processImage(), and it looks like the output is fine in GLTFLoader. There is still an issue with the UVs though. The UV Map seems to be translated now. I imported the gltf into blender using https://github.com/ksons/gltf-blender-importer |
Looks like the translation was due to a bug in the importer. It now looks ok. Does look like flipping UVs in processMesh works ok. |
/ping @donmccurdy |
Can you share an example where the current behavior is not setting up the normal map correctly, and your proposed fix? We cannot flip the UVs blindly, because we don't know the UV coordinate system. A few thoughts:
|
Apologise for the delay in responding. The example I had where this wasn't working is a proprietary asset and I cannot share it. Trying to construct an example but am not being very successful (not a 3D modelling person). In our project, we are interested in export only and the mesh is transient and not used further. So, it seemed ok to just modify the geometry. For threejs exporter, I don't have an elegant suggestion. If we have to flip UVs, the right place to do it is where we create the BufferView. One option is to special case the processBufferView code for UVs and write out a flipped UV. Similarly, processImage should not flip the texture. If we choose to not flip UVs, the normals needs to be transformed to match gltf coordinate system, I guess. Not sure how to do that. |
GLTF Loader: Fix for handedness in Normal Texture:
#11825
KhronosGroup/glTF#952
https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/GLTFLoader.js#L2204
material.normalScale.y = - material.normalScale.y;
Given that the loader needs to adjust this, should the exporter be adjusting this as well?
Please do correct me if I'm wrong, but the current code does not seem to account for this.
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: