⚖️ Gimbal Vector Analogy (GAN Math)
Latent-space 'king minus man plus woman' — with the ghosting fixed
- concept_A
- concept_B
- concept_C
- mask
- result_latent
- isolated_delta_vector
- telemetry
If you've seen the famous word-embedding trick - king − man + woman ≈ queen - GimbalVectorAnalogy is that idea applied to images. You give it three concept latents (A, B, C) and it computes C + (A − B), transferring the attribute that separates A from B onto C. "Architecture at daytime" minus "daytime" plus "night" gives you night architecture. It's GAN-era concept arithmetic, dropped into ComfyUI.
How it works
The three concept inputs are concept_A (the one with the attribute you want: "man with glasses"), concept_B (the same subject without it: "man"), and concept_C (the recipient: "woman"). The node extracts the delta A − B - the glasses direction - and adds it to C at a strength you set (default 1.0, −5 to +5). concept_C gets its own tooltip: "New recipient concept," and the three are the whole story of the math.
But here's where the pack earns its keep. Direct spatial vector addition on diffusion latents almost always produces phantom double-exposure ghosting - the delta A − B carries A's entire spatial face layout, and adding it to C stamps A's face topology onto C. The node has two safeguards for this:
spatial_mode-Spatial_Direct(raw add) versusChannel_Mean, which computes a global per-channel offset instead of a per-pixel one, killing the spatial phantom entirely.ortho_project- projects the delta perpendicular to C before adding, removing the C-parallel component so you don't double-count what C already has.preserve_norm(default on) - rescales the output to match C's spherical radius, so the result stays in the healthy latent-density shell.
There's also an optional mask to restrict the analogy to a region. Outputs: result_latent, isolated_delta_vector (the pure A − B direction, handy for reusing elsewhere), and telemetry.
What it's actually good for
Global attribute transfers - mood, lighting temperature, scene type - not identity or facial features. Keep strength modest (0.3–0.7) and use Channel_Mean with ortho_project on for anything near a face. This is the one node in the pack whose docs candidly show failure cases (the "spatial direct" ghosting example), which is refreshingly honest and a sign the math was actually tested.
Installing
Standard pack install: ComfyUI Manager → search "Gimbal-comfy" → install → restart, or git clone https://github.com/FormAndNoise/Gimbal-comfy into ComfyUI/custom_nodes. Dependencies are torch/numpy/pillow, already bundled; nothing downloads. (The README's clone URL is stale - FormAndNoise/Gimbal-comfy is live.)
Where people get burned
The ghosting. If your result looks like two faces superimposed, you're in Spatial_Direct mode with ortho_project off - switch to Channel_Mean and turn on ortho_project. Second, an analogy is only as clean as its concepts: A and B should differ in exactly the attribute you want to transfer, and C should be everything else you want in the result. Sloppy concepts give sloppy deltas. And don't expect identity-level transfer - "add glasses to this woman" works better than "make this woman into that man," because identity lives in spatial structure that spatial arithmetic mangles. This is a fun, well-tested-for-the-genre node, just don't ask it to do what the GAN-era hype promised.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| concept_A | LATENT | Target concept with desired attribute (e.g. Man with glasses) | |
| concept_B | LATENT | Base concept without attribute (e.g. Man) | |
| concept_C | LATENT | New recipient concept (e.g. Woman) | |
| strength | FLOAT | 1.00-5–5 | — |
| spatial_mode | COMBO | Spatial_Direct | Channel_Mean computes global per-channel offset to eliminate spatial phantom face/ghosting artifacts |
| ortho_project | BOOLEAN | false | Removes C-parallel component from delta to avoid double-counting |
| preserve_norm | BOOLEAN | true | Rescales output to match recipient C's spherical radius |
| maskopt | MASK | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| result_latent | LATENT | — |
| isolated_delta_vector | LATENT | — |
| telemetry | DICT | — |