The channel selection you do in the Matte Combine control will do exactly the same thing as using the ChannelBooleans for that purpose. It is, in fact, just a mini version of the Boolean built into Matte Control for convenience. The color of the matte doesn't matter at all, except that you'll want to be sure that the value of whatever channel you choose to use is 1 where the matte is supposed to be solid. Since it appears a little red, the red channel is obviously the one to use, but you might need to threshold it with a Bitmap node to ensure the range is correct.
It's a bit outside the scope of the topic at hand, but ChannelBooleans is a general utility node with a lot of uses: Adding CG components together is a common one. Diffuse + Reflect + Specular is a pair of ChannelBooleans in Add mode (but don't forget to set Alpha to Do Nothing). You can use it to pull a Z channel out, manipulate it with a BrightnessContrast, then inject it back into the main image. Use CreateBump to make normals out of your alpha, like this:
- Code: Select all
{
Tools = ordered() {
Blur1 = Blur {
Inputs = {
Filter = Input { Value = FuID { "Fast Gaussian" }, },
XBlurSize = Input { Value = 25.2, },
Input = Input {
SourceOp = "BrightnessContrast1",
Source = "Output",
},
},
ViewInfo = OperatorInfo { Pos = { 385, -16.5 } },
},
ErodeDilate1 = ErodeDilate {
Inputs = {
Filter = Input { Value = 2, },
XAmount = Input { Value = -0.18, },
Input = Input {
SourceOp = "Background1",
Source = "Output",
},
},
ViewInfo = OperatorInfo { Pos = { 385, -82.5 } },
},
BrightnessContrast1 = BrightnessContrast {
Inputs = {
Alpha = Input { Value = 1, },
Gamma = Input { Value = 1.95, },
Input = Input {
SourceOp = "ErodeDilate1",
Source = "Output",
},
},
ViewInfo = OperatorInfo { Pos = { 385, -49.5 } },
},
CreateBumpMap1 = CreateBumpMap {
Inputs = {
FilterSize = Input { Value = FuID { "5" }, },
Input = Input {
SourceOp = "Blur1",
Source = "Output",
},
SourceChannel = Input { Value = FuID { "Alpha" }, },
HeightScale = Input { Value = 100, },
BumpmapTextureDepth = Input { Value = 3, },
},
ViewInfo = OperatorInfo { Pos = { 385, 16.5 } },
},
Background1 = Background {
CtrlWZoom = false,
Inputs = {
Width = Input { Value = 1920, },
Height = Input { Value = 1080, },
Depth = Input { Value = 3, },
["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
TopLeftRed = Input { Value = 0.188, },
TopLeftGreen = Input { Value = 0.020304, },
TopLeftBlue = Input { Value = 0.020304, },
EffectMask = Input {
SourceOp = "Ellipse1",
Source = "Mask",
}
},
ViewInfo = OperatorInfo { Pos = { 220, 49.5 } },
},
Shader1 = Shader {
Inputs = {
Ambient = Input { Value = 1, },
Diffuse = Input { Value = 0, },
Specular = Input { Value = 1.449, },
Reflection = Input { Value = 0, },
EquatorAngle = Input { Value = -25.4, },
DiffuseCurve = Input {
SourceOp = "Shader1DiffuseCurve",
Source = "Value",
},
SpecularCurve = Input {
SourceOp = "Shader1SpecularCurve",
Source = "Value",
},
SpecularGreen = Input { Value = 0.9, },
SpecularBlue = Input { Value = 0.9, },
Input = Input {
SourceOp = "ChannelBooleans1",
Source = "Output",
},
},
ViewInfo = OperatorInfo { Pos = { 550, 49.5 } },
},
Shader1DiffuseCurve = LUTBezier {
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
SplineColor = { Red = 255, Green = 128, Blue = 0 },
NameSet = true,
},
Shader1SpecularCurve = LUTBezier {
KeyColorSplines = {
[0] = {
[0] = { 0, RH = { 0.333333333333333, 0.333333333333333 }, Flags = { Linear = true } },
[1] = { 1, LH = { 0.666666666666667, 0.666666666666667 }, Flags = { Linear = true } }
}
},
SplineColor = { Red = 255, Green = 255, Blue = 255 },
NameSet = true,
},
ChannelBooleans1 = ChannelBoolean {
Inputs = {
ToRed = Input { Value = 4, },
ToGreen = Input { Value = 4, },
ToBlue = Input { Value = 4, },
ToAlpha = Input { Value = 4, },
EnableExtraChannels = Input { Value = 1, },
ToXNormal = Input { Value = 0, },
ToYNormal = Input { Value = 1, },
ToZNormal = Input { Value = 2, },
Background = Input {
SourceOp = "Background1",
Source = "Output",
},
Foreground = Input {
SourceOp = "CreateBumpMap1",
Source = "Output",
},
},
ViewInfo = OperatorInfo { Pos = { 385, 49.5 } },
},
Ellipse1 = EllipseMask {
Inputs = {
Filter = Input { Value = FuID { "Fast Gaussian" }, },
MaskWidth = Input { Value = 1920, },
MaskHeight = Input { Value = 1080, },
PixelAspect = Input { Value = { 1, 1 }, },
ClippingMode = Input { Value = FuID { "None" }, },
Width = Input { Value = 0.247398607384522, },
Height = Input { Value = 0.247398607384522, },
},
ViewInfo = OperatorInfo { Pos = { 110, 49.5 } },
}
}
}
Get the intersection of two mattes with And or Multiply mode. Lots of possibilities; way more than I could possibly list.
Back on topic...
Any matte manipulation you need to do prior to injecting it would be done in the branch before it's put into the MatteControl.
As of right now, I haven't yet heard of an AI-driven rotoscoper that produces production-quality work. Rotobot from Kognat apparently does a good enough job for temps, although I couldn't get the plug-in to run when I tried it at work, and his web store wouldn't let me download a second copy for experimenting at home, so I didn't really get the chance to try it for myself. That's the best one I've seen in demos so far. What that means is that if you're using the auto-roto for core and garbage mattes, you'll probably be doing some work prior to the matte control to create an acceptable composite matte. Here's where you'll likely really use ChannelBooleans.
Let's suppose you have sufficient control to get your auto-roto to give you not only a core matte but also a garbage matte. Both of these mattes are white where the actor is and black outside. You're going to do some keying and manual roto to get a quality edge, which will be white along the edges but may be any color elsewhere.
Combining the core and edge mattes is easy. ChannelBooleans has a Maximum mode, so wherever the edge matte drops below white in the core, the automated core matte will fill it in.
There may still be non-black areas outside the talent, so you need to use the garbage matte to knock those out. There are a couple of options. You could use a ChannelBooleans in Negative mode to invert the garbage matte, then a second Booleans to either Clear or Subtract from the main matte. Or you could use a single ChannelBooleans in Multiply or And* mode to intersect the two mattes—any pixel that is black in
either image becomes black in the output. That would complete your matte, which you'd then inject with MatteControl.
*AND is, I believe, mathematically identical to Multiply, but some people find it easier to understand semantically: I want white where this AND that are both white.