-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
The STL loader flips the faces #13317
The STL loader flips the faces #13317
Conversation
… combinations (RH for useRightHandedSystem, NO_ALTER for DO_NOT_ALTER_FILE_COORDINATES): NO_ALTER-true NO_ALTER-false RH-true good bad RH-false bad good The correct combination for whether flip the face indices is like the following table, which means, we should only detect DO_NOT_ALTER_FILE_COORDINATES but not useRightHandedSystem: NO_ALTER-true NO_ALTER-false RH-true flip no-flip RH-false flip no-flilp
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/13317/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/13317/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/13317/merge#BCU1XR#0 |
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 do not understand how this will flip the faces in right handed mode after this PR which is needed ?
Not the space I am the most familiar with but I guess rightHanded should be used somewhere ?
@bghgary any thoughts ?
I have the same thought. We have to take |
+1 I'm wondering as well, the result came from my experiments, but I don't fully understand. Let me dive deeper and update back to this thread. |
Moving to draft in the mean time |
I think I found the issue. First, I don't think we need to update index for right handed system because it's a "runtime" behavior, doesn't need to update data. Instead, it's calculated during runtime, switch back face culling from CCW to CW. For example, one of these "runtime" approaches are: the setter of This is the playground demonstrates: when I set the index as CCW for LH, it works for both LH and RH, even though in RH, it's CW. |
Makes kinda sense :-) @bghgary, you can try For all the combinations DO_NOT_ALTER_FILE_COORDINATES and useRightHandedSystem with the stl loader. |
And this is still OK #12957 Thanks a lot for the fix !!! |
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 see. The STL loader doesn't need to check useRightHandedSystem
because STL uses the default material which already accounts for it. I think we should probably add some tests for these cases, but it doesn't have to be part of this PR.
The STL loader flips the faces Former-commit-id: e56d62846f18d3e571566796964fd8acec685695
The current code loads STL files with faces flipped for the following combinations (RH for
useRightHandedSystem
, NO_ALTER forDO_NOT_ALTER_FILE_COORDINATES
):The correct combination for whether flip the face indices is like the following table, which means, we should only detect
DO_NOT_ALTER_FILE_COORDINATES
but notuseRightHandedSystem
: