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

Node: NormalMatrix issues #17360

Closed
WestLangley opened this issue Aug 27, 2019 · 3 comments
Closed

Node: NormalMatrix issues #17360

WestLangley opened this issue Aug 27, 2019 · 3 comments

Comments

@WestLangley
Copy link
Collaborator

This pattern, which appears in NormalNode and NodeBuilder, is not correct:

result = ( modelMatrix * vec4( objectNormal, 0.0 ) ).xyz;

...unless you assume the model matrix is uniformly-scaled. I don't think we can assume it is.

To fix this, see this article. The relevant three.js method is Matrix3.getNormalMatrix( matrix ).


This pattern, on the other hand,

result = ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz;

is assumed to be OK because we assume the viewMatrix is not scaled at all.

/ping @sunag

@sunag
Copy link
Collaborator

sunag commented Aug 27, 2019

What do you think about this other pattern?

result = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;

@sunag
Copy link
Collaborator

sunag commented Aug 27, 2019

It is to obtain the worldNormal

@WestLangley
Copy link
Collaborator Author

That is correct. See Transforming Normal Vectors with the Inverse Transformation here.

sunag added a commit to sunag/three.js that referenced this issue Aug 27, 2019
@mrdoob mrdoob closed this as completed Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants