ThreeJS doesnt properly render objects those have scale(-1,-1,-1)

@dubois I engaged in the discourse about this issue a few years ago…

Initially I needed it for importing a kind of skinnedmesh that mirrored half of the model to create the other side of the model as an optimization.

The discussion convinced me that while it is a legitimate operation in some contexts, it’s actually pretty ill defined for reasons similar to what you’re referencing.

If you mirror one axis, its pretty trivial to figure out how to flip the winding to be correct, but what happens when you flip 2 axes.. or 3?
Is there a “correct” way to handle it?

Then there is also what happens with zero scales.. which is a similar kettle of fish.

1 Like

thanks so much this fixed my issues with the invisible shadows on mesh, I didn’t know the shadow issues is actually flipped normal issues. cheers

2 Likes

I think i need to draw a sketch, but my hunch is telling me that these cancel out? Eg at some point, you could achieve the same with just rotation? Half of the skinned human, has to be mirrored once. But if you mirror it along another axis, you could just rotate it and get the same result. Then if you flip the last axis, you again end up with a mirror.

1 Like

Sounds plausible.. like it flips with each - axis?

Each mirroring toggles the coordinate system left-handedright-handed. So even number of toggles (whatever the axes are) keeps the handiness the same, odd number – toggles it.

Two coordinate systems with the same handiness can always turn into each other by a mere rotation; for systems with different handiness this is impossible.

2 Likes

Ah, thats a much better way of putting it. Yeah, if you flip two, you end up in the same handedness, thus, you can just rotate. One, turns it from right handed to left handed, you cant rotate into that position, it is a mirror.

1 Like

This issue is about WebGPURenderer. If you are using WebGLRenderer, reflections in the world matrix should work as described in the original PRs (see WIP: Support negative scale factors by WestLangley · Pull Request #12720 · mrdoob/three.js · GitHub and Support reflections in world transform by WestLangley · Pull Request #12787 · mrdoob/three.js · GitHub ).

That said, the bug in WebGPURenderer is going to be fixed with the next release r180.

2 Likes

I filed a bug report finally: Components as Scaled Objects in GLB from Sketchup Export · Issue #31994 · mrdoob/three.js · GitHub I hope this leads a solution!