
ANR AI Matte Perfector
Give it a rough or hard matte and the plate, and an AI matting model rebuilds the edge: hair, fur, motion blur and fine detail.
- Masking
- Masking pack
- Masking models
- 3 inputs
- 42 controls
Overview
AI Matte Perfector refines a matte you already have. It takes the matte from a roto, a key, ANR AI Matte Propagator or any other source, finds the band round its edge, and lets an AI matting model solve that band again from the plate at full resolution. Hair, fur, motion blur and other soft detail come back; the solid inside of the matte stays solid.
It runs no tracking: each frame is refined from the matte you give it on that frame. Refine Band Inside and Refine Band Outside set how far the model may move the edge, and the Cleanup section removes specks, fills holes, grows, shrinks or feathers the result.
The result can be frozen to 16-bit PNG files with Freeze and Bake to Disk, so the comp opens with no AI engine running.
Inputs
- Sourcerequired
The plate. When nothing is connected to Mask, Source must be RGBA and its alpha is the matte to refine.
- Maskoptional
The matte to refine (its alpha). When connected, it is used instead of the Source's alpha.
- Holdoutoptional
An optional matte (its alpha) applied to the finished matte as set by Holdout Mode: added, cut out, or intersected.
Output. The Source with the refined matte in alpha. Display defaults to Straight (RGB + alpha), the picture untouched; it can also show the matte alone, the picture premultiplied, or a tinted overlay for checking.
Quick start
- Add ANR AI Matte Perfector. Connect the plate to Source and your matte to Mask (or connect a plate that already carries the matte in its alpha to Source alone).
- View the node with the alpha channel shown and compare it with the matte you gave it.
- Keep Edge Refiner on ViTMatte, or try MEMatte, which is lighter on a 4K plate.
- Raise Refine Band Outside until wispy hair is caught (30 or more for long hair); keep it near 8 for a clean skin or cloth edge.
- If the refined edge comes out a little inside or outside the subject, adjust Binarize Threshold: lower makes the matte bigger.
- Set a Cache Folder (or press Generate Autofill) and press Bake Frames to freeze the result for the whole shot.
The panel
The node's panel as Nuke shows it, with the values of a new node. Click any control to see what it does; tabs and sections work as in Nuke.
No control matches.
All controls
ANR AI Matte Perfector42 controls
- StatusStatus
status What the node is doing, or what it needs: a matte on Mask, or an RGBA Source with an alpha.
- Freeze and Bake to DiskCheckbox
bake Write every frame that renders as a 16-bit RGBA PNG (the matte in rgb and alpha) and play them back from disk. With this on, opening the comp starts no AI engine and uses no graphics memory. Turn it off to re-render.
- Import Baked FootageButton
importBaked Creates a Read node for the baked sequence right under this node (through Nuke's own Python). If the host cannot do that, the Read goes on the clipboard instead: hover the node graph and press Ctrl+V.
Bake Settings
- Generate AutofillButton
anrCacheAutoFill Create a new node-type/footage_letter_4digits folder on every click, then stop. Previous caches are kept. Enter a folder to choose a custom base.
Makes a new, empty folder for this node each time you click it and puts it in Cache Folder. It goes next to the saved script by default (ANR > Cache Folders > Location in Nuke's menu bar can put it next to the footage); a folder you typed into Cache Folder is used as the base instead. Save the script first.
- Cache FolderFile
bakeDir Each node writes //.####.png. Read the sequence back with an ordinary Read node.
Each node writes into a subfolder named after Name Prefix: with the default prefix,
anr_matte/anr_matte.####.pnginside this folder. Two nodes with the same folder and prefix write over each other, so give each node its own folder (Generate Autofill does) or its own prefix.- Name PrefixText
bakePrefix Prefix for the subfolder and the file names; #### sets the frame padding. Empty uses the node's own id.
- Limit to Frame RangeCheckbox
bakeRange Only bake (and matte) frames inside the range below; the rest pass through. Off: Bake Frames bakes the Source's whole range.
- Bake FromSlider
bakeFrom First frame to bake.
- Bake ToSlider
bakeTo Last frame to bake.
- Bake FramesButton
bakeFrames Bake now, without playing through the shot: every frame from Bake From to Bake To when Limit to Frame Range is on, otherwise the Source's whole range. Each frame is matted again and written as a 16-bit RGBA PNG (the matte in rgb and alpha) into the Cache Folder; Freeze and Bake to Disk turns on, so they play back from disk. Cancel on the progress bar stops it.
- Edge RefinerMenu
refiner Raw: the soft mask straight from the tracker, shaped by Edge Softness. Hard: thresholded, no refiner. MEMatte / ViTMatte: AI edge matting for hair, fur and soft edges -- the best quality, a little slower. MEMatte is lighter on a 4K plate.
This node offers only the two matting models; the tooltip's Raw and Hard choices belong to ANR Matte Creator.
- Edge StabilitySlider
edgeStability Reduce flicker using motion-aligned neighbouring frames. 0 is off. Higher values use more temporal averaging. Rejects unreliable motion and large changes; requires additional frame processing.
- Binarize ThresholdSlider
binarize Where the tracker's probability is cut into foreground and background. Drives Hard output, the centre of the refiner's band, and the cleanup. SAM's own midpoint is 0.5, but that sits about 2 pixels inside the edge a commercial matte draws on a 4K plate; 0.3 matched it. Lower is bigger.
Here the threshold cuts your input matte: pixels above it are inside the subject, and the refine band is centred on that cut.
- Refine Band InsideSlider
trimapErode How far inside the edge is definitely foreground, in pixels. Small keeps the edge where the tracker put it; large lets the refiner move it further inward.
- Refine Band OutsideSlider
trimapDilate How far outside the edge the refiner may grow detail, in pixels. The main quality knob: 8 for a clean cloth or skin edge, 30 or more for long wispy hair. Wider is softer, and slower.
- Edge SmoothingSlider
edgeSmooth Rounds the edge, in pixels. With a matting model it is a blur applied only inside the refiner's band, removing the model's grain; with Hard or Raw output it rounds the cut through the scaled-up tracker probability. 1.5 matches a clean commercial matte; 0 is off.
- DisplayMenu
display Matte Overlay: the picture with each object tinted, alpha carries the matte. Matte Only: black and white. Premultiplied: the picture cut out by the matte. Straight: the picture untouched with the matte in alpha.
- Overlay OpacitySlider
overlayMix How strongly each object is tinted in Matte Overlay.
Cleanup
- Close GapsSlider
closeGaps Smooth the tracked mask before it is cut: creases, notches and thin slits narrower than this many pixels are closed, so the edge does not chase a shadow between an arm and the body. 0 is off. It also closes real gaps of that size (between fingers), so keep it small.
- Fill Holes Before RefineCheckbox
refineFillHoles Close every enclosed hole in the hard matte before it goes to the matting model, so the refiner only solves the outer edge. Off when the subject has real gaps (between an arm and the body).
- Remove SprinklesSlider
removeSprinkles Drop disconnected islands up to this area, in full-resolution pixels. 0 is off.
- Fill HolesSlider
fillHoles Fill enclosed holes up to this area, in pixels. 0 is off.
- Shrink / GrowSlider
shrinkGrow Contract (negative) or expand (positive) the matte, in pixels.
- FeatherSlider
feather Soften the matte edge with a blur, in pixels.
- Holdout ModeMenu
holdoutMode How the Holdout input is applied to the finished matte. Add is a union, Subtract cuts it out, Intersect keeps only the overlap.
Edge (expert)
- Solve Uncertain AreasCheckbox
trimapAdaptive Where the tracker itself is unsure (fingers, hair, thin edges: probabilities well away from 0 and 1), no Binarize Threshold is right, so those pixels go to the matting model instead of being cut. Where the tracker is sure, the threshold and the trimap band apply as usual.
- Solve Existing Soft EdgeCheckbox
trimapSoft Pixels that are already partly transparent (a keyer, a blurred roto, a soft mask input) join the uncertain band as well.
- Edge ContrastSlider
edgeContrast Tighten the refined edge. 1 keeps the matting model's answer, including motion blur and hair; 2 halves the width of every transition and also hardens motion blur, so use it only on a sharp, static edge that came out soft.
- Trimap Pre-BlurSlider
trimapPreblur Smooth the mask before building the trimap, to soften the upscale staircase.
- Show TrimapCheckbox
showTrimap Paint the trimap in the viewer: green inside, cyan outside, grey the band the refiner solves. View only.
Shows only when Display is Matte Overlay.
- Refiner Tile SizeSlider
tileSize How much of the edge goes to the matting model at a time, in pixels. The edge is never reduced: a bigger subject is more tiles. Lower this if you run out of graphics memory.
Levels
- Input BlackSlider
inBlack Shape the raw soft mask before it is cut: black, white and gamma.
- Input WhiteSlider
inWhite Shape the raw soft mask before it is cut: black, white and gamma.
- Input GammaSlider
inGamma Shape the raw soft mask before it is cut: black, white and gamma.
- Output BlackSlider
outBlack Remap the finished matte. A white point of 0.99 snaps a nearly solid interior to a clean 1.0.
- Output WhiteSlider
outWhite Remap the finished matte. A white point of 0.99 snaps a nearly solid interior to a clean 1.0.
- Output GammaSlider
outGamma Remap the finished matte. A white point of 0.99 snaps a nearly solid interior to a clean 1.0.
System
- DeviceMenu
device Automatic uses the GPU and compiles the encoder for it once (about a minute the first time). GPU skips the compile. CPU is many times slower and only for machines without an NVIDIA card.
- Apply sRGB to InputCheckbox
srgbInput The models were trained on display-referred pictures. On, for a linear working space (Nuke's default): the plate is converted to sRGB before the model sees it. Off when the input is already display-referred or you colour-manage upstream. Only the picture the AI sees changes.
- Mask Cache (MB)Slider
cacheBudget How much memory tracked masks may take per node before the oldest are dropped. Bake to disk for long shots.
- Load ModelsButton
loadModel Start the inference helper and load SAM 3 now. Otherwise it happens on the first render.
Loads the matting model chosen in Edge Refiner ahead of the first render. This node loads no tracking model.
- UnloadButton
unloadModel Stop the helper and give every byte of graphics memory back.
Tips
- Set Display to Matte Overlay and turn on Show Trimap to see the band the model solves: green is kept as solid, grey is solved, the rest is background.
- A soft input matte (a blurred roto or a keyer) is solved across its whole soft area because Solve Existing Soft Edge is on. Turn it off to refine only round the cut edge.
- Fill Holes Before Refine makes the model work on the outer edge only; leave it off when the subject has real gaps, such as between an arm and the body.
- Edge Contrast above 1 tightens a sharp, static edge that came out soft. It also hardens motion blur, so leave it at 1 on moving subjects.
- Lower Refiner Tile Size if the graphics card runs out of memory on a large subject.
- Edge Stability steadies an edge that flickers from frame to frame, using the frames on either side; each frame takes longer to render while it is above 0.
Good to know
- The node needs an NVIDIA graphics card for practical speeds; Device > CPU is many times slower.
- If the Masking models were not installed with ANR Tools, Nuke offers to download them the first time you add the node in a session (Download models or Not now). After the download, render the frame again.
- Nothing is baked until Cache Folder is set. With Limit to Frame Range on, frames outside the range pass the Source through untouched.
- After about ten minutes without work (sooner when the graphics card is nearly full), the node gives its graphics memory back. The next frame loads the model again, which takes a moment.
Something unclear or missing? Write to [email protected].