Nodes/comfyui_cv/CV Mesh From 3D Model
ComfyUI Node

CV Mesh From 3D Model

Reads the GEOMETRY of a 3D model file into plain arrays: vertices (Nx3) and triangle indices (Mx3), ready for 'cv2 rapid rapid', 'CV ICP Register', 'CV PPF Pose Estimation' or 'CV Point Cloud Normals'. Every triangle primitive of the default scene is merged into ONE indexed mesh with the node transforms baked in - the same parser 'CV Preview 3D (Calibrated Camera)' renders with, so what you see and what you measure cannot drift apart. Materials, UVs and normals are dropped; positions and connectivity only. GLB is the reliable format (a .gltf with external buffers will not resolve them). Failure tolerant: an unreadable or non-triangle model returns empty arrays with loaded=false rather than halting.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Mesh From 3D Model
  • model_3d
  • pts3d
  • tris
  • center
  • diameter
  • vertex_count
  • triangle_count
  • loaded
axis_conventionOpenCV (Y down, Z into the scene)
recenterkeep model origin
scale1.00
Categoryimage/CV/low-level

Inputs (4)

NameTypeDefaultDescription
model_3dFILE_3D_GLB,FILE_3D_GLTF,FILE_3DModel from a 3D loader node ('Load 3D', 'Load 3D (Advanced)'). GLB is the format that actually works: a .gltf with external buffers will not resolve them from the temp folder.
axis_conventionCOMBOOpenCV (Y down, Z into the scene)glTF stores Y up and Z toward the viewer; OpenCV's camera looks down +Z with Y down. Leave this on the OpenCV setting whenever the mesh feeds solvePnP, cv2.rapid or projectPoints alongside a real camera pose - it negates Y and Z, exactly the flip 'CV Camera Pose To 3D View' applies in the other direction. Pick the glTF setting only to compare against the viewer's own coordinates.
recenteroptCOMBOkeep model originWhere the returned points put the origin. The model origin is what a pose solved against this mesh will refer to, so keep it unless you specifically want the object's own centre (a pose then means 'centre of the object', which is usually what an annotation anchor wants). 'centroid' averages the vertices, so dense regions pull it.
scaleoptFLOAT1.000.000001–1000000Multiplies every coordinate. Use it to put the mesh in the SAME units as the camera pose - a model authored in centimetres needs 0.01 against a calibration in metres, and a scale mismatch shows up as a pose that is right in direction and wrong in depth.

Outputs (7)

NameTypeDescription
pts3dNPARRAYNx3 float32 vertices. This is the 'pts3d' input of the cv2.rapid nodes and a valid Nx3 point cloud for 'CV Point Cloud Normals' / ICP / PPF.
trisNPARRAYMx3 int32 triangle indices into pts3d - the 'tris' input of the cv2.rapid nodes. Winding follows the file; cv2.rapid's backface culling depends on it, so a model exported with flipped normals silhouettes inside out.
centerNPARRAY1x3 bounding-box centre of the RETURNED points (after recentre and scale). Wire it to 'CV Transform Points 3D' or use it to place an annotation anchor.
diameterFLOATBounding-box diagonal of the returned mesh, in the same units. The natural scale reference: an edge budget for 'CV Mesh Split Long Edges' is a fraction of this, and PPF's sampling steps are fractions of it too.
vertex_countINTNumber of vertices (0 when loaded=false).
triangle_countINTNumber of triangles (0 when loaded=false).
loadedBOOLEANFalse when the file could not be read or holds no triangles. Gate the rest of the graph on it with an 'If/Else Switch' instead of letting empty arrays reach a solver.