Hi, one thing is always troubled me that what is the correct way to invert a face?
As all known that, gpu decides face’s direction by indices clockwise/counterclockwise in different platform. Usually, if we want to invert a face which indices are p1 p2 p3, we can set indices p3 p2 p1 , it work in most of time. But in some case, this way is not working, p1 p2 p3 is the same direction with p3 p2 p1. When I set indices p2 p3 p1 / p3 p1 p2 face is inverted. it is certainly that p1 p2 p3 ,p2 p3 p1 and p3 p1 p2 are the same clock,why p1 p2 p3 is one direction p2p3p1/p3p1p2 are another?
I find that when I load model from glb file,I have to set p2 p3 p1/p3 p1 p2 to invert face, I don’t know why
Hello
Absolutely, I would just add “as per seen from the camera view angle”. (I mean that the clockwise/counterclockwise is computed in 2D).
Theorically, you would not need to fix these manually (By manually, I mean switching the indexing from p1,p2,p3 to p3,p2,p1 or whatever). A mesh, whatever the number of faces, should have a consistent orientation from a face to another. For example in Blender, when you “recalculate normals”, they are all computed again (either inside or outside) and then the wrapping index will be consistent from a face to another, at export time.
Now, back to BabylonJS, when for some reason the indexing is reversed, (for example have a look HERE) either you can change the direction on all the scene, either you can just change it for a specific material :
material.sideOrientation = 0; // clockwise
material.sideOrientation = 1; // counterclockwise
I agree that those orders should be considered as the same direction, though