Docs Visual

MaskDraw

Draw a mask with the mouse straight onto the image: a panel you paint in, with the mask and the masked image as outputs, a lock and a reset.

◧ Visual ◆ Patreon · Pro

Why use it

Some masks are quicker to draw than to build: the part of a wall your projector should hit, the region of a camera image you want to key, a shape around a performer that no threshold will find. Drawing one usually means leaving TouchDesigner for an image editor, exporting a file and loading it back in, and doing it all again when the stage moves.

MaskDraw lets you paint the mask straight onto the image inside your network. The strokes accumulate into a mask, which comes out on its own and applied to the input.

Features

  • Paint and erase on the imagePaint on the input image with the left button and erase with the right; the panel follows the input's aspect.
  • Output the mask and the masked imageOutputs the drawn mask and the input inside the painted area, to key a composite, drive a Level or mark a projection surface.
  • Reset the maskMiddle-click in the panel clears the mask, and so does Reset, which keeps it clear while it is on.
  • Show or hide the button barCtrl and middle-click shows or hides the button bar, and Show Input, Show Mask and Show Brush choose what the panel draws.
  • Lock a finished maskLock keeps a finished mask from being changed by a stray click or reset.
  • Pause drawingSwitching Active off hides the brush and ignores the mouse, and the mask stays as it is.
  • Save the mask with the projectOptionally bakes the mask into the component on every save, so it is back when the project reopens.

How to use it

  1. Create it from the FNS tab of the OP Create dialog.
  2. Wire the image you want to mask into it: a camera, a movie, a still of the projection surface.
  3. Open MaskDraw's panel. The input image is your canvas, and the panel follows the input's aspect.
  4. Paint with the left button and erase with the right. Radius sets the brush size, relative to the mask. Drawing works while Active is on; switch it off and the brush hides and the mouse is ignored, with the mask kept.
  5. To start over, middle-click in the panel. Reset does the same: the mask stays clear for as long as it is on.
  6. Ctrl and middle-click shows or hides the button bar in the panel, the same as Display UI. Show Input, Show Mask and Show Brush change what the panel draws while you paint: the input behind the mask, the mask in white, and the brush outline in red.
  7. When the mask is right, switch on Lock. New strokes, erasing and Reset are ignored until you turn it off, so a stray click during a show cannot change it.
  8. Use the outputs: out_mask is the mask itself, and out_masked is the input inside the painted area. Key a composite with it, drive a Level, or mark a projection surface.

Keeping the mask

By default the mask lives in the running session and nothing is written into the file, so it is gone when you reopen the project. Turn on Save Mask With Project and the mask is baked into the component on every project save, or right away with Bake Mask Now, and restored when the project is reopened. The baked texture is the size of the panel, so the file grows by a few megabytes.

Inputs and outputs

  • in1 (TOP): the image to draw over.
  • out_mask (TOP): the drawn mask.
  • out_masked (TOP): the input inside the painted area.

Get it

This tool unlocks with Patreon. It installs through the same picker as everything else and unlocks with the Patreon Pro tier or higher, connected from inside TouchDesigner. Everything else in the toolkit stays free and MIT, and the membership is what keeps that work moving.

Join on Patreon → How unlocking works →

Parameters

Custom

ControlType / defaultWhat it does
ActiveActive on / offoff Enables drawing. Off hides the brush and ignores the mouse; the painted mask is kept.
RadiusRadius number0.1 The brush radius, relative to the size of the mask.
Show InputShowinput on / offoff Shows the input image in the display panel behind the mask. Off shows the input only inside the painted area.
Show MaskShowmask on / offoff Draws the painted mask (white) over the image in the display panel.
Show BrushDebug on / offoff Shows the brush outline (red) under the pointer in the display panel.
Display UIDisplay on / offon Shows the button bar in the display panel. Ctrl + middle-click in the panel toggles it.
ResetReset on / offoff While on, clears the painted mask. A middle-click in the panel does the same. Ignored while Lock is on.
LockLock on / offoff Freezes the painted mask: new strokes, erasing and Reset are ignored until it is turned off. The mask lives in a feedback loop, so it is not saved with the file.
Save Mask With ProjectSavemask on / offoff On: the current mask is baked into the component on every project save (and by Bake Mask Now), so it is restored when the project is reopened. Off (default): the mask lives only in the session and nothing is written into the file.
Bake Mask NowBakemask button Capture the current mask into the component now, without waiting for a project save. Only with Save Mask With Project on.