Nodes/ComfyMath/Vec3UnaryCondition
ComfyUI Node

Vec3UnaryCondition

Check if a 3D vector is zero or unit length

By evanspearman·Created 3 years ago·Updated about a year ago· 192
Vec3UnaryCondition
  • a
  • BOOL
op

Two questions come up constantly once you're working with 3D vectors as values: is this vector empty (a common "nothing happened yet" sentinel), and is this vector already normalized (unit length, ready to use as a pure direction)? Vec3UnaryCondition answers either and hands back a boolean.

It's part of ComfyMath, evanspearman's math/logic pack, and it's the natural gate to put in front of anything that assumes a vector is already zero or already a unit direction - a camera-facing vector, a surface normal - instead of assuming and finding out three nodes later that you were wrong.

How it works

Pick an op from four choices - IsZero, IsNotZero, IsNormalized, IsNotNormalized - and feed it a, your VEC3 (default [0, 0, 0]). IsZero/IsNotZero check whether the vector is exactly [0, 0, 0], useful for treating a zero vector as a sentinel default or an "unset" state. IsNormalized/IsNotNormalized check whether the vector's length is 1 - that is, whether it's already a pure direction rather than a direction-plus-magnitude, which matters a lot for things like surface normals that are expected to be unit length by convention.

The two pairs are complementary, not opposites of each other: a vector can be neither zero nor normalized (say, [3, 0, 4], which has length 5), so don't assume IsNotZero implies IsNormalized or vice versa - they're independent checks answering different questions about the same value.

Inputs and outputs

  • op - IsZero, IsNotZero, IsNormalized, IsNotNormalized.
  • a (VEC3, default [0, 0, 0]) - the vector being tested.
  • Output: BOOL - ComfyMath's own boolean type.

How to install it

Via ComfyUI Manager: search ComfyMath, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/evanspearman/ComfyMath.git

then restart ComfyUI. No dependencies, no models - plain Python arithmetic.

Common issues & troubleshooting

IsNormalized comes back false for a vector that "should" be unit length. Like float equality, this is an exact check on a computed length, and floating-point math rarely lands on exactly 1.0 even when a vector was deliberately normalized upstream - tiny rounding error is enough to flip this to false. If you're chaining a CM_Vec3UnaryOperation Normalize step into this check and it's failing when it shouldn't, that's the likely cause, not a bug in either node.

The BOOL output won't wire into a native switch node. This node outputs ComfyMath's own BOOL type, not ComfyUI's built-in BOOLEAN. Route it through logic that accepts BOOL, or use one of ComfyMath's BOOLEAN-outputting nodes elsewhere if a specific downstream node insists on the native type.

Missing node error loading a shared workflow. Install ComfyMath through Manager as above, then reload.

Not sure you need Vec3 nodes at all. Most generation workflows never touch them - they matter in graphs doing your own 3D direction, offset, or coordinate logic, not a standard checkpoint-to-image pipeline.

The pack looks unmaintained. A 2024 community thread noted the author had stepped back from active development. Vec3 is the least-used, least-changed corner of ComfyMath, so treat it as small and stable rather than actively developed.

Categorymath/vec3

Inputs (2)

NameTypeDefaultDescription
opCOMBO4 options: IsZero, IsNotZero, IsNormalized, IsNotNormalized
aVEC30,0,0

Outputs (1)

NameTypeDescription
BOOLBOOL