Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign updetermine if normals are flipped by a reflection in the normalMatrix instead of object.matrixWorld #14379
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 |
|
@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. |
haxiomic
commented
Jun 5, 2020
•
|
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 |
Korijn commentedJun 27, 2018
•
edited
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.