Nodes/comfyui_cv/CV Mesh Vertex Normals
ComfyUI Node

CV Mesh Vertex Normals

Turns a MESH (vertices + triangles) into the Nx6 (x,y,z,nx,ny,nz) cloud 'CV PPF Pose Estimation' and 'CV ICP Register' want, with the normals taken from the TRIANGLE WINDING - so they point consistently outward instead of being sign-arbitrary. Use this, not 'CV Point Cloud Normals', whenever the cloud comes from a mesh: a plane fit through k neighbours cannot tell inside from outside, and on a closed model matched against a single-view scene that ambiguity puts the PPF pose ~180 degrees out (measured 177-179 on the shipped example, against 9.2 with these normals). Each vertex gets the AREA-WEIGHTED sum of its incident face normals, so large triangles dominate the average as they should. Wire it AFTER 'CV Mesh Split Long Edges' - that node adds vertices, and normals must follow the final topology. Failure tolerant: an empty mesh or an index out of range returns empty arrays with found=false.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Mesh Vertex Normals
  • pts3d
  • tris
  • cloud
  • normals
  • found
orientationoutward (follow triangle winding)
Categoryimage/CV/low-level

Inputs (3)

NameTypeDefaultDescription
pts3dNPARRAYNx3 vertices, from 'CV Mesh From 3D Model' or 'CV Mesh Split Long Edges'.
trisNPARRAYMx3 int triangle indices into pts3d. The WINDING is the whole input here: a model exported with flipped faces gives inward normals, which is what the orientation combo is for.
orientationCOMBOoutward (follow triangle winding)glTF and OBJ both wind counter-clockwise seen from outside, so the default is right for anything a 3D loader hands you. Flip it when a match comes back consistently 180 degrees out AND the scene normals are already oriented - that is the signature of a model whose faces are inside out.

Outputs (3)

NameTypeDescription
cloudNPARRAYNx6 float32 (x,y,z,nx,ny,nz) - feed this to 'CV PPF Pose Estimation', 'CV ICP Register' or 'CV Downsample Point Cloud'.
normalsNPARRAYNx3 float32 unit normals only, in vertex order (for drawing, filtering, or a back-face test).
foundBOOLEANFalse when the mesh is empty or an index points past the end of pts3d.