Check individual face normal of a single mesh

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.

is this what you are looking for?

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.

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

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

So something more like this?

1 Like

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.

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!


1 Like

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 this tool you worked on i would like to know more on what your goal was!

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

1 Like