SWIZZLE (JOV) π΅
Recombine vector components without the headache
- π °οΈ
- π ±οΈ
- VECTOR
- π¦
Swizzling is one of those graphics-programming tricks that sounds exotic until you see how often it's the exact thing you need. You have two vectors - a position and an offset, a color and a mask, anything - and you want to rearrange their components into a new one. Maybe you want (B.x, A.y, A.z, A.w) because one axis should come from the other vector. Doing that with separate VALUE nodes and manual math is a chore. SWIZZLE is that chore, packaged.
It takes π °οΈ and π ±οΈ - any of the numeric types: boolean, int, float, vec2/3/4, or 2D/3D coordinates. Then four swizzle controls, one per output component: SWAP X, SWAP Y, SWAP Z, and SWAP W. Each is a dropdown that picks where that output component comes from: a component of A (A_X, A_Y, A_Z, A_W), a component of B (B_X, B_Y, B_Z, B_W), or a CONSTANT. When you choose CONSTANT, the value comes from the VECTOR input (a VEC4, default all zeros). The β dropdown sets what comes out the other end - VEC2, VEC2INT, VEC3, VEC3INT, VEC4, VEC4INT, or COORD2D - so you build exactly the shape you need. The single output π¦ matches that requested type.
In practice: swap the first component of A for the first component of B and you've "crossed" two values. Rearrange (B_X, A_Y, A_Z, A_W) to pull one axis from a second vector - the bread and butter of aligning two objects or clamping one dimension. Mix in CONSTANT and you can pin an output axis to a fixed number without a separate node. If your vectors are RGBA colors, swizzle is also channel remapping: (B_R, B_G, A_B, A_A) mixes two colors' channels into one, which is the same idea as PIXEL SWAP but on pure values instead of images.
Two things to know before you click around. First, the tooltips on SWAP X/Y/Z are a bit sloppy - they all say "Replace input Red channel..." even for the W axis; that's a copy-paste from the color version, ignore the wording and trust the dropdown semantics. Second, the defaults are identity (A_X, A_Y, A_Z, A_W), so a fresh SWIZZLE passes A through unchanged - a good sanity anchor when you're debugging a rearrangement.
SWIZZLE is a current node, and it got a real quality pass in the pack's 2.1.0 cleanup, where the output-type enums were aligned with the cozy_comfyui system. If you're feeding it from a VALUE (JOV) node or a ComfyMath vector, they interoperate fine - the pack explicitly added ComfyMath compatibility in 2.1.5.
Install is pack-wide: ComfyUI Manager β search "Jovimetrix", or
cd ComfyUI/custom_nodes
git clone https://github.com/Amorano/Jovimetrix.git
pip install -r Jovimetrix/requirements.txt
then restart. Shared dependencies only (numpy, opencv-contrib-python, Pillow, matplotlib, cozy-comfyui helpers), no model downloads. Keep ComfyUI at 0.1.3+ with a current frontend and you're good.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| π °οΈopt | BOOLEAN,FLOAT,INT,VEC2,VEC3,VEC4,VEC2INT,VEC3INT,VEC4INT,COORD2D,COORD3D | Input A | |
| π ±οΈopt | BOOLEAN,FLOAT,INT,VEC2,VEC3,VEC4,VEC2INT,VEC3INT,VEC4INT,COORD2D,COORD3D | Input B | |
| βopt | COMBO | VEC3 | Output type desired from resultant operation |
| SWAP Xopt | COMBO | A_X | Replace input Red channel with target channel or constant |
| SWAP Yopt | COMBO | A_Y | Replace input Red channel with target channel or constant |
| SWAP Zopt | COMBO | A_Z | Replace input Red channel with target channel or constant |
| SWAP Wopt | COMBO | A_W | Replace input W channel with target channel or constant |
| VECTORopt | VEC4 | 0,0,0,0 | Compound value of type float, vec2, vec3 or vec4 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| π¦ | * | β |