This helps you build an alpha channel from video with a blue-screen or green-screen (or other) background color by interactively selecting colors from an image and refining the key. It also smooths alpha edges and eliminates color spill.
NOTE: Get the latest chromeKey component from the palette in 088 builds 52000 or later. An older version is found below.
It is a pure TouchDesigner compositing network underneath that uses methods employing the ChromaKey, Blur and Lookup TOPs together with DATs and small python scripts.
Unzip the ChromaKey.3.zip file and drag-drop chromakey.tox to any network.
Then connect a video stream (can be a movie) to Input 1 of the chromakey component, such as the video that’s included with the ChromaKey.1.zip file, and select Input 1 in the UI.
Or you can select the source to be Movie File and drag-drop a movie in the movie player, then scrub the movie to various frames.
Then you can hook a background video stream or still image to input 2 to see your result composited.
Next you want to select the key color. In the large middle image of the UI, select Input 1 and then left-click the mouse over a part of the key color, and drag the mouse around to gather more pixels that are the key color.
Then you can middle-click or Ctrl-click or Alt-click to add to the key color selection. The key color selection is a min-to-max of hue, a min-to-max of saturation and a min-to-max of luminance.
If you mess up, press Undo or start again by left-clicking on the image. And there’s Undo to go back up to 10 steps ago.
It may be tricky to select key color when the input video is rapidly changing. Instead you can press Sample Image a number of times, then drag the Samples slider below the sampled images to pick one of the images. You can then add to the key color selection. You can sample up to 8 images and use the sample slider to go between them.
Above the middle large image you can select what to put in the background of the preview: Black, Red, Input 2 or a standard background still.
You can also adjust the key color selection by moving the handles on the hue, saturation or level bars.
Bottom small image shows the spill mask on red. Spill is adjusted with the stack of 4 sliders beside it.
There’s also the alpha-smoothing slider to round-out and slightly soften the edges.
You can select 4 ways to output on the right - raw RGBA, composited over red, input2, etc.
It is created in TouchDesigner 088 build 8460. The .tox file is standalone (use it as-is in other files). In the Toe folder is the .toe version that is independent of /uig: ChromaKeyForTox.toe (from which the .tox was created), versus ChromaKey.toe that has its gadgets cloned from /uig.
I left some room in the UI so you can add your own extensions and re-post! Contact me if you need guidance.
And a big thanks to Hal Lovemelt of Playatta (playatta.com) for the tips and the use of the sample video.
(version 2 reorganized files vs version 1)
(version 3 has better history/undo mechanism vs version 2)
(version 5 works with Builds 10300 and later)
( Version 10 is in the palette of 088 builds 52000 or later )