# What Is The Correct Way To Invert A Triangle Face?

**URL:** <https://forum.babylonjs.com/t/what-is-the-correct-way-to-invert-a-triangle-face/53210>\
**Category:** Questions\
**Created:** [September 4, 2024, 12:42pm UTC](https://forum.babylonjs.com/t/what-is-the-correct-way-to-invert-a-triangle-face/53210 "2024-09-04T12:42:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [September 4, 2024, 12:42pm UTC](https://forum.babylonjs.com/t/what-is-the-correct-way-to-invert-a-triangle-face/53210/1 "2024-09-04T12:42:46Z")

</div>

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？

---

<div class="post-metadata">

**Author:** ![Moriy](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/moriy/32/30563_2.png) [@Moriy](https://forum.babylonjs.com/u/Moriy)\
**Post date:** [September 4, 2024, 1:09pm UTC](https://forum.babylonjs.com/t/what-is-the-correct-way-to-invert-a-triangle-face/53210/3 "2024-09-04T13:09:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [September 4, 2024, 4:34pm UTC](https://forum.babylonjs.com/t/what-is-the-correct-way-to-invert-a-triangle-face/53210/4 "2024-09-04T16:34:54Z")

</div>

Hello 🙂

> [@Moriy](#):
>
> As all known that, gpu decides face’s direction by indices clockwise/counterclockwise in different platform

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](https://forum.babylonjs.com/t/set-sideorientation-to-clockwise-is-not-working-in-script-but-works-in-inspector/34340/5)) either you can change the direction on all the scene, either you can just change it for a specific material :

```javascript
material.sideOrientation = 0; // clockwise
material.sideOrientation = 1; // counterclockwise

```

* * *

> [@Moriy](#):
>
> why p1 p2 p3 is one direction p2p3p1/p3p1p2 are another？

I agree that those orders should be considered as the same direction, though 🤔
