Blender exporter glb getting Nan for normal vector in some part of the face

Hello everyone

i export a glb file by blender exporter and i need to get the normal vector of the faces when i click on each point of the faces, but in some points i got the (Nan, Nan, Nan) for the normal vector values, should i do any setting when i export a glb file by blender to get the normal vector correctly on all points of the face?

Heya, AFAIK you don’t need to do anything special in Blender for that… :thinking: Can you post the code that you’re using to lookup the normal when a face is clicked on? Maybe there’s an array index being miscomputed there. Or ideally if you can post a small playground for this then we could check the code and check out the model’s normals too. :slight_smile:


Assuming there actually are missing normals you can use the following method on your models mesh:

function resetNormals(mesh) {
  const positions = mesh.getVerticesData("position")
  const indices = mesh.getIndices()
  const normals = []
  BABYLON.VertexData.ComputeNormals(positions, indices , normals)
  mesh.updateVerticesData(BABYLON.VertexBuffer.NormalKind, normals)
  console.log('updated mesh with normals: ', normals)