# Check individual face normal of a single mesh

**URL:** <https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274>\
**Category:** Questions\
**Created:** [May 3, 2024, 10:42pm UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274 "2024-05-03T22:42:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Silver](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/silver/32/31136_2.png) [@Silver](https://forum.babylonjs.com/u/Silver)\
**Post date:** [May 3, 2024, 10:42pm UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/1 "2024-05-03T22:42:26Z")

</div>

I’m trying to export a blender model to babylon.js and wanted control over the face data so that in babylon.js i could check each face separately and preform a task. The goal is to use a single mesh to make it a single draw call instead of exporting each face as a separate mesh object and check the face normal, which i have done but want to really avoid.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 3, 2024, 10:46pm UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/2 "2024-05-03T22:46:13Z")

</div>

is this what you are looking for?

> **[Babylon.js Playground](https://playground.babylonjs.com/#X10SCO%231)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Silver](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/silver/32/31136_2.png) [@Silver](https://forum.babylonjs.com/u/Silver)\
**Post date:** [May 3, 2024, 11:04pm UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/3 "2024-05-03T23:04:48Z")

</div>

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/1/3/137210cf6eb41e9d7e6a5f1516d81b530108a778.png)  
this is my blender viewport, These are 3 different meshes separated and I separated them by color to illustrate that. I have been able to determine each face’s normal and complete a task based on their normal. But doing this creates 3 draw calls, What i want is to still be able to determine their face orientations like before using the normals but instead i want them joined into 1 mesh. So it will be 1 draw call with 3 different face orientation data i can retrieve.

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 3, 2024, 11:38pm UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/4 "2024-05-03T23:38:42Z")

</div>

Then the method I posted for you should work. Just merge the mesh I’m blender.

---

<div class="post-metadata">

**Author:** ![Silver](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/silver/32/31136_2.png) [@Silver](https://forum.babylonjs.com/u/Silver)\
**Post date:** [May 3, 2024, 11:53pm UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/5 "2024-05-03T23:53:59Z")

</div>

i’m not looking to click the mesh, i need it check if the mesh is facing the camera or not, If a face is facing the camera, then i perform a task, if the face is not facing the camera, then i perform a different task

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 4, 2024, 2:24am UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/6 "2024-05-04T02:24:30Z")

</div>

> **[Babylon.js Playground](https://playground.babylonjs.com/#RKXZPG%231)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

So something more like this?

---

<div class="post-metadata">

**Author:** ![Silver](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/silver/32/31136_2.png) [@Silver](https://forum.babylonjs.com/u/Silver)\
**Post date:** [May 4, 2024, 3:34am UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/7 "2024-05-04T03:34:53Z")

</div>

wow amazing!!! But will i know which face i am checking, for example when I’m exporting the mesh from blender is there a way i can identify each face using things like vertex colors? I haven’t messed around much with the playground you sent, but it seems like it need to be a little more accurate, i updated the camera controls so that it using the ArcRotationCamera to give it a better demo. [https://playground.babylonjs.com/#RKXZPG#2](https://playground.babylonjs.com/#RKXZPG#2)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/9/7992e95d0e742f123c5265204249474479c05647.png)

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 4, 2024, 3:47am UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/8 "2024-05-04T03:47:17Z")

</div>

Just drop the threshold down to like 0.2 or something and yeah you can use vertexColor or custom buffers to identify specific faces. The class and function would need to be updated some but Ill leave that to you!

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/4/2/424fe58be68b459ce586f3bb2621597800c1866c.png)

---

<div class="post-metadata">

**Author:** ![Silver](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/silver/32/31136_2.png) [@Silver](https://forum.babylonjs.com/u/Silver)\
**Post date:** [May 4, 2024, 3:58am UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/9 "2024-05-04T03:58:01Z")

</div>

Thank you! 1 have no idea how that code works, but i will use chatGPT or something! Also i have no idea how vertex colors will help me, but i will do my research and maybe tag you here if you don’t mind with my progress? Also i’m a huge fan of [https://www.babylonjs-playground.com/#G3GZA1#162](https://www.babylonjs-playground.com/#G3GZA1#162) this tool you worked on i would like to know more on what your goal was!

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [May 4, 2024, 4:16am UTC](https://forum.babylonjs.com/t/check-individual-face-normal-of-a-single-mesh/50274/10 "2024-05-04T04:16:06Z")

</div>

I’m around pretty much always and feel free to tag me when you have questions.
