ComfyUI Node

Nuke Corner Pin

Pin a screen into a shot without leaving ComfyUI

By sumitchatterjee13·Created about a year ago·Updated 9 days ago· 59
Nuke Corner Pin
  • image
  • IMAGE
to1_x0.00
to1_y0.00
to2_x1.00
to2_y0.00
to3_x1.00
to3_y1.00
to4_x0.00
to4_y1.00
filtercubic

This is the node you reach for when a flat, front-on image needs to live in a perspective shot. You've composited a character or UI onto a background, and it's standing there looking painted-on. Feed the flat image in here, drag the four corners to where the surface actually is, and it gets warped into place. Same idea as the CornerPin in Nuke - hence the name - but running as a pure PyTorch custom node in ComfyUI, so no Nuke license and no The Foundry software required.

It's a screen-replacement and perspective-matching workhorse. Slap a logo or a monitor feed onto a wall, tilt a generated texture to match a floor plane, put a poster onto the side of a building. If you do any amount of image compositing in ComfyUI, this one earns its place next to the merge nodes.

How it works

The image's four corners - top-left, top-right, bottom-right, bottom-left - are remapped to the four to positions you set. The whole image is then resampled with grid_sample (bilinear by default), and anything outside the warped quad comes back transparent, not black, so the result comps cleanly over a background.

One honest caveat, because the source code says so out loud: the warp is a bilinear interpolation between the corners, not a true perspective homography. For typical screen replacements - a monitor angled away from you, a poster on a wall - it looks right and nobody will call it out. If you need geometrically exact perspective with converging vanishing lines, this will be slightly off at the extremes. It's a "good enough for comp" tool, and mostly it genuinely is.

The inputs that matter

The corner coordinates are normalized, 0 to 1 across the image, which trips people up once before it clicks:

  • to1_x / to1_y - top-left corner (defaults to 0,0)
  • to2_x / to2_y - top-right corner (defaults to 1,0)
  • to3_x / to3_y - bottom-right corner (defaults to 1,1)
  • to4_x / to4_y - bottom-left corner (defaults to 0,1)

So with all defaults you get the image unchanged. Move to3 toward to1 and the far edge shrinks - instant perspective. Values can exceed 1 or go negative, which is how you push a corner off-frame.

filter is the only other knob: nearest or bilinear. Leave it on bilinear unless you're doing pixel art or need hard edges.

The single output is an IMAGE at the same resolution as the input, with transparent padding. Wire it into a merge (over) on top of your background and you're done.

Installing it

It ships in the Nuke Nodes pack for ComfyUI, so you get it with everything else:

cd ComfyUI/custom_nodes
git clone https://github.com/sumitchatterjee13/nuke-nodes-comfyui.git nuke-nodes
cd nuke-nodes
pip install -r requirements.txt

Or skip all that and search "Nuke Nodes" in ComfyUI Manager - same result, then restart ComfyUI. The node lives under the Nuke category in the menu.

Common issues

  • Edges look soft or the quad doesn't align - remember the coordinates are normalized to the source image, not the whole canvas. Adjust the corners after wiring it over the background, not before.
  • It doesn't do real perspective - that's by design, see above. If converging lines matter, be ready to eyeball it and nudge.
  • Background shows through where it shouldn't - the transparent padding only exists outside the quad, so the image itself still covers its own area. Put your background behind, merge with over, and you're set.

For most comps this is the fastest path from "flat generated image" to "sits in the scene."

CategoryNuke/Transform

Inputs (10)

NameTypeDefaultDescription
imageIMAGE
to1_xFLOAT0.00-1–2
to1_yFLOAT0.00-1–2
to2_xFLOAT1.00-1–2
to2_yFLOAT0.00-1–2
to3_xFLOAT1.00-1–2
to3_yFLOAT1.00-1–2
to4_xFLOAT0.00-1–2
to4_yFLOAT1.00-1–2
filterCOMBOcubic4 options: impulse, cubic, lanczos, area

Outputs (1)

NameTypeDescription
IMAGEIMAGE