-
-
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
GLTFLoader: Flip normalScale without tangents. #18112
Conversation
I assume you are referring to this? |
@WestLangley Indeed, much appreciated! |
examples/js/loaders/GLTFLoader.js
Outdated
@@ -2262,6 +2262,14 @@ THREE.GLTFLoader = ( function () { | |||
|
|||
if ( materialDef.name !== undefined ) material.name = materialDef.name; | |||
|
|||
// Normal map textures use OpenGL conventions: | |||
// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#materialnormaltexture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that comment explains the ensuing code block...
Maybe referencing #11438 (comment) would be OK?
/ping @donmccurdy |
examples/js/loaders/GLTFLoader.js
Outdated
|
||
material.normalScale.y = - material.normalScale.y; | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check that this is OK on a model with vertexTangents
? Note that we're in the loadMaterial
method here, and .vertexTangents
wouldn't be set until later, in the assignFinalMaterial
method, when we have access to the mesh and can confirm whether it has tangents. I think the change will need to be moved there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, found the repro with your shoe.glb. Moved and verified the fix. Thanks!
Thanks! |
Fixes #11438
After reading this comment I applied this change to model-viewer. It appears to be the right change, given all the models I've seen. I think it also makes sense given the chain rule explanation given in that thread as well.