ANR Tools

ANR Matte Creator

Draw a box, click a point or type a word on one frame, and the AI model mattes that subject through the whole shot, with clean hair and soft edges.

  • Masking
  • Masking pack
  • Masking models
  • 3 inputs
  • 68 controls

Overview

Matte Creator makes a matte from a prompt instead of a roto. On one frame, the Init Frame, you draw a box round the subject, click it, or type what to find ("person", "red car"). The tracking model cuts the subject out on that frame and carries it forward and backward through the shot as you play.

Each prompt is its own object, with its own colour in the viewer, up to eight objects. Where the AI gets a frame wrong, you click Add FG Refine Point on something missing or Add BG Refine Point on something that leaked in, on that frame; the track runs again from there.

The edge is then refined at full resolution by a matting model (ViTMatte or MEMatte in Edge Refiner), which recovers hair, fur and motion blur in a band round the edge. The Cleanup section removes specks, fills holes, shrinks, grows or feathers the matte, and the Holdout input adds or cuts away another matte.

When the matte is right, Freeze and Bake to Disk writes it to 16-bit PNG files and plays them back, so the comp opens with no AI engine running and no graphics memory used.

Inputs

SourceMaskHoldoutMatte CreatorOutput
  1. Sourcerequired

    The plate to matte. The AI sees its picture; the output keeps its colour.

  2. Maskoptional

    An optional matte (its alpha). With Mask Input set to Track It, the mask on the Init Frame becomes an object the AI follows, for example a quick roto of one part. With Refine Only, there is no tracking: this matte is refined and cleaned on every frame.

  3. Holdoutoptional

    An optional matte (its alpha) applied to the finished matte as set by Holdout Mode: added to it, cut out of it, or intersected with it.

Output. The Source with the finished matte in alpha. Display sets the RGB: the picture tinted per object (Matte Overlay), the matte in black and white, the picture premultiplied by the matte, or the picture untouched (Straight (RGB + alpha)).

Quick start

  1. Add ANR Matte Creator under the plate and view it. Go to a frame where the subject is clearly visible.
  2. With Tool on Add Box Object, drag a box round the subject in the viewer. Or set Tool to Add Point Object and click it, or type a word in Text Prompt and press Add Objects by Text. This frame becomes the Init Frame.
  3. Play forward from the Init Frame. Each frame is tracked from the one before; to get the frames before the Init Frame, play or step backward from it.
  4. Where the matte is wrong on a frame, pick Add FG Refine Point or Add BG Refine Point and click on that frame. The track runs again from there.
  5. For hair and soft edges keep Edge Refiner on ViTMatte or MEMatte. Raise Refine Band Outside for long or wispy hair; lower it for a clean skin or cloth edge.
  6. Set Display to Straight (RGB + alpha) or Premultiplied before you use the node in the comp.
  7. Set a Cache Folder (or press Generate Autofill), then press Bake Frames to write the whole shot to disk and play it back from there.

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.

ANR_Matte_Creator1
Status
Freeze and Bake to Disk
Import Baked Footage
Generate Autofill
Cache Folder
Name Prefixanr_matte.####
Limit to Frame Range
Bake From1
Bake To100
Bake Frames
ToolAdd Box ObjectPoint DetailAuto
Text Prompt
Add Objects by Text
Init Frame0Go to Init Frame
Reset SceneReset TrackClear Refine PointsDelete Selected
Edge RefinerViTMatte
Edge Stability0
Binarize Threshold0.3
Refine Band Inside6
Refine Band Outside20
Edge Smoothing1.5
Edge Softness0.1
DisplayMatte Overlay
Overlay Opacity0.5
Crop ModePer object (recommended)
Crop Padding %20
Crop Follows Objects
Crop Aspect Limit1.5
Manual Crop Bottom-Leftx0y0
Manual Crop Top-Rightx0y0
Set Manual Crop From Auto
Close Gaps0
Fill Holes Before Refine
Remove Sprinkles100
Fill Holes0
Shrink / Grow0
Feather0
Holdout ModeAdd
Tracking ModeLocked Init Frame
Enrich First Frame
Mask InputOff
Score Threshold0.3
Overlap Threshold0.5
Solve Uncertain Areas
Solve Existing Soft Edge
Edge Contrast1
Trimap Pre-Blur0
Show Trimap
Refiner Tile Size1536
Input Black0
Input White1
Input Gamma1
Output Black0
Output White1
Output Gamma1
Show Viewer ControlsShow Object Panel
Viewer Controls Size1
DeviceAutomatic (GPU, compiled)
Apply sRGB to Input
Mask Cache (MB)768
Load ModelsUnload

All controls

ANR Matte Creator68 controls
StatusStatusstatus

What the node is doing: loading models, tracking, baking, or what it needs from you next.

Freeze and Bake to DiskCheckboxbake

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 edit. Matte Creator asks for confirmation; freezing again refreshes each rendered frame, and Bake Frames replaces the selected range.

Default: off

Import Baked FootageButtonimportBaked

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 AutofillButtonanrCacheAutoFill

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 FolderFilebakeDir

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.####.png inside 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.

Default: empty

Name PrefixTextbakePrefix

Prefix for the subfolder and the file names; #### sets the frame padding. Empty uses the node's own id.

Default: anr_matte.####

Limit to Frame RangeCheckboxbakeRange

Only bake (and matte) frames inside the range below; the rest pass through. Off: Bake Frames bakes the Source's whole range.

Default: off

Bake FromSliderbakeFrom

First frame to bake.

Default: 1

Bake ToSliderbakeTo

Last frame to bake.

Default: 100

Bake FramesButtonbakeFrames

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.

ToolMenuselectionTool

Select objects with boxes or points. Add foreground/background refine points to correct the selected object on a frame.

Default: Add Box ObjectOptions: Select / Edit Add Box Object Add Point Object Add FG Refine Point Add BG Refine Point

Point DetailMenupointLevel

How big a piece one click grabs. Auto lets the model choose; Small, Medium and Large pick the smallest, middle or largest of its three candidates -- a hand, an arm, the whole person. Remembered per point.

Default: AutoOptions: Auto Small Medium Large

Text PromptTexttextPrompt

What to find, e.g. "person" or "red car". Press Add by Text; every instance found on the init frame becomes its own object. Comma-separate several phrases.

Default: empty

Add Objects by TextButtontextSubmit

What to find, e.g. "person" or "red car". Press Add by Text; every instance found on the init frame becomes its own object. Comma-separate several phrases.

Init FrameSliderinitFrame

The frame the objects were created on. Tracking runs forward and backward from here.

Default: 0

Go to Init FrameButtongoToInit

Jump the timeline to the init frame.

Reset SceneButtonresetScene

Remove every object. The next object starts a fresh scene on the frame you are on.

Reset TrackButtonresetTrack

Throw away the tracked masks and the model's memory, keep the objects. Go to the init frame and play to track again.

Clear Refine PointsButtonclearRefines

Remove every FG / BG refine point from every object.

Delete SelectedButtondeleteSelected

Remove the object selected in the viewer.

Edge RefinerMenurefiner

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.

Default: ViTMatteOptions: Raw (soft) Hard MEMatte ViTMatte

Edge StabilitySlideredgeStability

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.

Default: 0

Binarize ThresholdSliderbinarize

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.

Default: 0.3

Refine Band InsideSlidertrimapErode

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.

Default: 6

Refine Band OutsideSlidertrimapDilate

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.

Default: 20

Edge SmoothingSlideredgeSmooth

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.

Default: 1.5

Edge SoftnessSlideredgeSoftness

Raw only. How wide the soft band around the threshold is, in model confidence. 0.10 gives a crisp antialiased edge; larger lets more of the model's uncertainty through.

Default: 0.1

DisplayMenudisplay

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.

Default: Matte OverlayOptions: Matte Overlay Matte Only Premultiplied Straight (RGB + alpha)

Overlay OpacitySlideroverlayMix

How strongly each object is tinted in Matte Overlay.

Default: 0.5

Crop

Crop ModeMenucropMode

Which part of the frame the model sees. It always works on a fixed 1008x1008 picture, so a crop around the objects gives them more pixels and a sharper edge. Off sends the whole frame (most context, least detail on a 4K plate). Union crops round all objects together. Manual is a rectangle you draw and can animate. Per object gives each tracked instance its own crop and refinement region. It preserves detail on separated subjects but uses more inference and memory.

Default: Per object (recommended)Options: Off (whole frame) Union (shared crop) Manual (draw it) Per object (recommended)

Crop Padding %SlidercropPadding

Margin around the objects inside the crop, as a percentage of their size. More padding is more room to move between frames and more context; less is more detail.

Default: 20

Crop Follows ObjectsCheckboxcropFollow

Slide the crop to keep the tracked objects inside it as they move.

Default: on

Crop Aspect LimitSlidercropAspect

How elongated the crop may be before it is padded toward a square. The model squashes the crop to a square, so a long thin one distorts; 1.5 is safe.

Default: 1.5

Manual Crop Bottom-LeftPositioncropBL

The rectangle the model sees, in Manual crop mode. Drag its handles in the viewer, or press Set Manual Crop From Auto to start from the crop the tracker chose. Animate it (set keys) to follow the subject; frames already tracked with a different crop are tracked again.

Default: 0 0

Manual Crop Top-RightPositioncropTR

The rectangle the model sees, in Manual crop mode. Drag its handles in the viewer, or press Set Manual Crop From Auto to start from the crop the tracker chose. Animate it (set keys) to follow the subject; frames already tracked with a different crop are tracked again.

Default: 0 0

Set Manual Crop From AutoButtoncropFromAuto

Copy the crop the tracker used on this frame into the Manual Crop, and switch to Manual.

Cleanup

Close GapsSlidercloseGaps

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.

Default: 0

Fill Holes Before RefineCheckboxrefineFillHoles

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).

Default: off

Remove SprinklesSliderremoveSprinkles

Drop disconnected islands up to this area, in full-resolution pixels. 0 is off.

Default: 100

Fill HolesSliderfillHoles

Fill enclosed holes up to this area, in pixels. 0 is off.

Default: 0

Shrink / GrowSlidershrinkGrow

Contract (negative) or expand (positive) the matte, in pixels.

Default: 0

FeatherSliderfeather

Soften the matte edge with a blur, in pixels.

Default: 0

Holdout ModeMenuholdoutMode

How the Holdout input is applied to the finished matte. Add is a union, Subtract cuts it out, Intersect keeps only the overlap.

Default: AddOptions: Off Add Subtract Intersect

Tracking

Tracking ModeMenutrackMode

Locked Init Frame: create objects on the init frame, press play, the mask propagates by memory. Per Frame: no memory at all -- every frame is segmented from the prompts as drawn, for the rare shot where tracking will not hold.

Default: Locked Init FrameOptions: Locked Init Frame Per Frame (no memory)

Enrich First FrameCheckboxenrichFirst

Run the init frame through the model's memory twice, so the starting mask is as clean as a tracked one. One extra pass on the seed frame only.

Default: on

Mask InputMenumaskUse

What the Mask input is for. Track It: the mask on the init frame becomes an object the AI follows -- a roto of one part, a luma key, anything. Refine Only: no tracking; the mask is refined and cleaned up on every frame, so this node polishes a matte made elsewhere.

Default: OffOptions: Off Track It (mask prompt) Refine Only (no tracking)

Score ThresholdSlidertextScore

Minimum confidence to keep a detection. Raise it if wrong things are found, lower it if the right one is missed.

Default: 0.3

Overlap ThresholdSlidertextIou

How much two detections may overlap before the weaker one is dropped.

Default: 0.5

Edge (expert)

Solve Uncertain AreasCheckboxtrimapAdaptive

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.

Default: on

Solve Existing Soft EdgeCheckboxtrimapSoft

Pixels that are already partly transparent (a keyer, a blurred roto, a soft mask input) join the uncertain band as well.

Default: off

Edge ContrastSlideredgeContrast

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.

Default: 1

Trimap Pre-BlurSlidertrimapPreblur

Smooth the mask before building the trimap, to soften the upscale staircase.

Default: 0

Show TrimapCheckboxshowTrimap

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, and only with ViTMatte or MEMatte as Edge Refiner.

Default: off

Refiner Tile SizeSlidertileSize

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.

Default: 1536

Levels

Input BlackSliderinBlack

Shape the raw soft mask before it is cut: black, white and gamma.

Default: 0

Input WhiteSliderinWhite

Shape the raw soft mask before it is cut: black, white and gamma.

Default: 1

Input GammaSliderinGamma

Shape the raw soft mask before it is cut: black, white and gamma.

Default: 1

Output BlackSlideroutBlack

Remap the finished matte. A white point of 0.99 snaps a nearly solid interior to a clean 1.0.

Default: 0

Output WhiteSlideroutWhite

Remap the finished matte. A white point of 0.99 snaps a nearly solid interior to a clean 1.0.

Default: 1

Output GammaSlideroutGamma

Remap the finished matte. A white point of 0.99 snaps a nearly solid interior to a clean 1.0.

Default: 1

Viewer

Show Viewer ControlsCheckboxshowOverlay

Show or hide the boxes, points and panel in the viewer.

Default: on

Show Object PanelCheckboxshowPanel

Show the object list in the viewer.

Default: on

Viewer Controls SizeSlideroverlayScale

Size of the viewer controls; try 1.5 on a 4K monitor.

Default: 1

System

DeviceMenudevice

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.

Default: Automatic (GPU, compiled)Options: Automatic (GPU, compiled) GPU CPU

Apply sRGB to InputCheckboxsrgbInput

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.

Default: on

Mask Cache (MB)SlidercacheBudget

How much memory tracked masks may take per node before the oldest are dropped. Bake to disk for long shots.

Default: 768

Load ModelsButtonloadModel

Start the inference helper and load SAM 3 now. Otherwise it happens on the first render.

UnloadButtonunloadModel

Stop the helper and give every byte of graphics memory back.

Tips

  • In the viewer's object panel, S solos an object, On / Off turns it off without deleting it, and the cross deletes it. An object the tracking model thinks has gone shows a low percentage, and the panel lists the frames worth checking.
  • Point Detail sets how much one click grabs: Small, Medium or Large pick a hand, an arm or the whole person; Auto lets the model choose.
  • Shift-click a point to delete it. With the viewer in focus, Delete or Backspace removes the point under the cursor or the selected object.
  • On a 4K plate, keep Crop Mode on Per object (recommended): the model works on a fixed-size picture, so a crop round each subject gives it more pixels. If the automatic crop cuts off part of the subject, press Set Manual Crop From Auto and drag the rectangle in the viewer; set keys on it to follow the subject.
  • Show Trimap paints the band the matting model solves (grey) in the viewer, with Display on Matte Overlay. Use it to judge Refine Band Inside and Refine Band Outside.
  • If the matte sits slightly inside the subject's edge, lower Binarize Threshold a little; raise it if the matte grabs background.
  • Edge Stability steadies a flickering edge using the neighbouring frames, at the cost of extra processing per frame.
  • Mask Input > Refine Only turns the node into an edge refiner for a matte made elsewhere (a roto or a key on the Mask input).
  • For a fringe of the old background in the edge colours, follow this node (Display Premultiplied) with ANR Edge Detail Extension.

Good to know

  • The node needs an NVIDIA graphics card for practical speeds. Device > CPU works on machines without one but is many times slower. Automatic compiles the model for your card the first time, which takes about a minute.
  • 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.
  • In Locked Init Frame mode, objects are created only on the Init Frame. To start somewhere else, press Reset Scene and draw again on the new frame.
  • Nothing is baked until Cache Folder is set. With Limit to Frame Range on, frames outside the range pass the Source through untouched.
  • Turning Freeze and Bake to Disk off asks for confirmation: freezing or baking again replaces the cached matte with your edits. Press Generate Autofill first if you want to keep the old version in a separate folder.
  • 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.
  • Long shots: tracked masks are kept in memory up to Mask Cache (MB); older ones are dropped and tracked again when needed. Bake the shot to avoid that.

Something unclear or missing? Write to [email protected].