Nodes/ComfyUI libigl/Visualize Normal Field
ComfyUI Node

Visualize Normal Field

See which way your normals point before they bite you

By PozzettiAndrea·Created 10 months ago·Updated 4 days ago· 218
Visualize Normal Field
  • trimesh
  • mesh_with_fields
  • info

Normals are the silent workflow-killers of 3D. A mesh can look perfect in the viewport and still break every downstream step - flipped faces, black shading, garbage bakes - because some of its normals point the wrong way. GeomPackVisualizeNormalField exists to make that visible. It's a diagnostic node: it doesn't fix anything, it reads the vertex normals of your mesh, writes them as per-vertex scalar fields, and hands you back the mesh so you can actually see what's going on in the pack's color-mapped VTK viewer.

Where it fits in the workflow

GeometryPack is full of repair tools - there's a whole Fix Normals node with six backends, plus check and compute normal nodes. This is the one you run before those, to see whether they're even needed. Is a scan's surface shading inconsistently? Are faces wound inward? Run this, look at the normal_z field in the viewer, and you'll instantly know which direction the surface is "facing" and where it flips. It's also genuinely useful for understanding a mesh you didn't create - a downloaded asset with a weird topology becomes a lot less mysterious when you can color the surface by its normal components.

How it works

The mechanism is deliberately simple. The node copies your mesh (so the input is never mutated), pulls vertex_normals from trimesh - those are the area-weighted normals trimesh derives from the face winding - and stores each component as a float32 per-vertex attribute:

  • normal_x, normal_y, normal_z - the direction components, each expected to sit between -1 and 1
  • normal_magnitude - the length of each normal vector, expected to be ~1.0 for unit normals

The info output prints the min/max of each channel and the average magnitude, which is your quick health check. Magnitudes clustering near zero on a chunk of the mesh means degenerate or collapsed faces; a field that's overwhelmingly one sign on the wrong side means the winding is backwards.

Inputs and outputs

  • trimesh - the only input, the pack-wide TRIMESH type from a Load Mesh node.
  • mesh_with_fields - a copy of your mesh carrying the four new vertex attributes. Wire this into the pack's Preview Mesh (VTK with Fields) viewer, where you can color-map any of the fields.
  • info - the text summary with per-channel ranges and mean magnitude.

Installing it

It's part of the pack, so install the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/PozzettiAndrea/ComfyUI-GeometryPack.git
cd ComfyUI-GeometryPack
pip install -r requirements.txt --upgrade
python install.py

Or search GeometryPack in ComfyUI Manager (nightly if the default version balks), then restart ComfyUI.

Where people get burned

Two things trip people up. First, this node reads normals but never writes them - if your goal is to fix a flipped surface, this is the reconnaissance, and Fix Normals is the follow-through. Send the mesh_with_fields output into a fix node and you've got a clean before/after story. Second, the install itself: the pack runs on an experimental comfy-env isolated environment that downloads pixi and heavy native libraries (Blender, CGAL, libigl, VTK), so first launch is slow. That's not a bug - give it time to build. And remember the pack is explicitly work-in-progress ("occasional breakage", per the author's own release notes), so if a field looks off, check the node's info output before blaming your mesh. Ninety percent of the time, the mesh really is the problem - that's why you reached for this node in the first place.

Categorygeompack/repair

Inputs (1)

NameTypeDefaultDescription
trimeshTRIMESH

Outputs (2)

NameTypeDescription
mesh_with_fieldsTRIMESH
infoSTRING