Skip to content
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

What is three.js's normal map handedness convention? #11315

Closed
donmccurdy opened this issue May 11, 2017 · 3 comments
Closed

What is three.js's normal map handedness convention? #11315

donmccurdy opened this issue May 11, 2017 · 3 comments
Labels

Comments

@donmccurdy
Copy link
Collaborator

It may be helpful to have this documented. @emackey pointed out an issue with GLTF2Loader (donmccurdy/three-gltf-viewer#10) and normal map inversion seems to be responsible. For comparison:

BabylonJS: x-axis = left, y-axis = down
OpenGL: x-axis = right, y-axis = up
DirectX: x-axis = right, y-axis = down

@emackey
Copy link

emackey commented Jul 22, 2017

Has there been progress on this?

In my own projects I'm fixing this manually by setting:

    material.normalScale.x = -1;

@donmccurdy
Copy link
Collaborator Author

I haven't heard anything. It would be nice to know, but I'm inclined to just flip normalScale.x if that works correctly with the sample models.

@emackey
Copy link

emackey commented Apr 9, 2018

The answers have been worked out by @WestLangley and @donmccurdy here: #13784 (comment)

Hopefully I'm summarizing correctly:

  • ThreeJS's default normal map handedness is OpenGL, right-handed, same as glTF.
  • ThreeJS's default UV origin is lower-left, opposite of glTF's upper-left UV origin.
  • As a result, GLTFLoader must flip the UVs and then flip the normal handedness to compensate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants