-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
determine if normals are flipped by a reflection in the normalMatrix instead of object.matrixWorld #14379
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
Conversation
|
What if the object that has the reflection is a parent? |
|
The normalMatrix is taken from the modelViewMatrix which is the product of the camera.matrixWorld and object.matrixWorld, so all parent transforms are included. This behaviour is correct and is not changed by this PR. |
|
/cc @WestLangley |
|
@Korijn Do you mind removing the builds commit? |
|
Yes! @berendkleinhaneveld is working on it |
This reverts commit b4eaa9d.
|
@mrdoob CI failed due to an |
|
Even if we disagree about the use case for negative camera scaling, I think we can agree on the fact that it makes more sense to check the determinant of the normalMatrix for this particular code path? :) |
Yes, I agree with that. I'll let @WestLangley decide on this one though. |
|
Thanks! |
|
Note: This has been reverted in #15825. Reflections in the camera matrix (or camera world matrix) are not supported. |
|
Alright, too bad. Thanks for the heads up. We'll resort to workarounds then. |
|
Sorry, @Korijn about reverting your feature. Sometimes we have to make judgment calls, and this was one of them. Glad to hear you have workarounds available. |
|
Just to add a point of view on this one: It makes a lot of sense to support reflections in camera matrices as this is the canonical approach to implement planar reflections (you take a camera's transform, reflect by your mirror plane and done :)) The original normal matrix approach was the best from an overall correctness point of view. I think #15825 would be better fixed by a different approach. I expect this will lead to less bugs in the future I'm on a full-time project right now so I'll just fork and restore the normalMatrix version for now but I'll take a look at fixing #15825 when I get a moment |
Determine if normals are flipped by a reflection in the normalMatrix instead of object.matrixWorld.
Fixes #14372.
This makes more sense, since the normalMatrix is the end-all transform that determines if the normals will be flipped or not. It's also more efficient, since the determinant of a Matrix3 is much cheaper to compute than that of a Matrix4.