A B-Spline mask is identical to a Polygon mask in all respects except one. Where Polygon masks use Bézier splines, this mask node uses B-Splines. Where Bézier splines employ a central point and two handles to manage the smoothing of the spline segment, a B-Spline requires only a single point. This means that a B-Spline shape requires far fewer control points to create a nicely smoothed shape.
When first added to a node, the B-Spline mask consists of only Center control, which is visible onscreen. Points are added to the B-Spline by clicking in the viewer. Each new point is connected to the last one created, but instead of the spline going directly through each control point, B-Spline control points only influence the spline shape. The control point pulls the spline in its direction to create a smooth curve.
Like the Polygon mask tool, the B-Spline mask auto-animates. Adding this node to the Node Editor adds a keyframe to the current frame. Moving to a new frame and changing the shape creates a new keyframe and interpolate between the two defined shapes.
B-Spline Mask Node Inputs
The B-Spline mask node includes a single effect mask input.
- Effect Mask: The optional blue input expects a mask shape created by polylines, basic primitive shapes, paint strokes, or bitmaps masks. Connecting a mask to this input combines the masks. How masks are combined is handled in the Paint mode menu in the Inspector.
B-Spline Mask Node Setup
The B-Spline node can be used to generate a single smooth spline shape or combined with other masks for more complex shapes. In the node tree below, the B-Spline mask is used to generate a smooth, curved shape as a garbage matte on the Delta Keyer.
B-Spline Mask Controls Tab
The Controls tab is used to refine how the B-Spline appears after drawing it in the viewer.
Show View Controls
The Show View Controls checkbox is used to enable/disable the display of the mask’s onscreen controls in the viewer. Onscreen controls, including center position, polylines, angles, and others, do not appear when this checkbox is disabled, even when the node is selected.
The Level control sets the transparency level of the pixels in the mask channel. When the value is 1.0, the mask is completely opaque (unless it has a soft edge). Lower values cause the mask to be partially transparent. The result is identical to lowering the blend control of an effect.
This control selects the filtering algorithm used when applying Soft Edge to the mask.
- Box: This is the fastest method but at reduced quality. Box is best suited for minimal amounts of blur.
- Bartlett: Otherwise known as a Pyramid filter, Bartlett makes a good compromise between speed and quality.
- Multi-box: When selecting this filter, the Num Passes slider appears and lets you control the quality. At 1 and 2 passes, results are identical to Box and Bartlett, respectively. At 4 passes and above, results are usually as good as Gaussian, in less time and with no edge “ringing.”
- Gaussian: The Gaussian filter uses a true Gaussian approximation and gives excellent results, but it is a little slower than the other filters. In some cases, it can produce an extremely slight edge “ringing” on floating-point pixels.
Use the Soft Edge slider to blur (feather) the mask, using the selected filter. Higher values cause the edge to fade off well beyond the boundaries of the mask. A value of 0.0 creates a crisp, well-defined edge.
The Border Width control adjusts the thickness of the mask’s edge. When the solid checkbox is toggled on, the border thickens or narrows the mask. When the mask is not solid, the mask shape draws as an outline, and the width uses the Border Width setting
Connecting a mask to the effect mask input displays the Paint mode menu. The Paint mode is used to determine how the incoming mask for the effect mask input and the mask created in the node are combined.
- Merge: Merge is the default for all masks. The new mask is merged with the input mask.
- Add: The mask’s values add to the input mask’s values.
- Subtract: In the intersecting areas, the new mask values subtract from the input mask’s values.
- Minimum: Comparing the input mask’s values and the new mask, this displays the lowest (minimum) value.
- Maximum: Comparing the input mask’s values and the new mask, this displays the highest (maximum) value.
- Average: This calculates the average (half the sum) of the new mask and the input mask.
- Multiply: This multiplies the values of the input mask by the new mask’s values.
- Replace: The new mask completely replaces the input mask wherever they intersect. Areas that are zero (completely black) in the new mask do not affect the input mask.
- Invert: Areas of the input mask that are covered by the new mask are inverted; white becomes black and vice versa. Gray areas in the new mask are partially inverted.
- Copy: This mode completely discards the input mask and uses the new mask for all values.
- Ignore: This mode completely discards the new mask and uses the input mask for all values.
Selecting this checkbox inverts the entire mask. Unlike the Invert Paint mode, the checkbox affects all pixels, regardless of whether the new mask covers them or not.
When the Solid checkbox is enabled, the mask is filled to be transparent (white) unless inverted. When disabled, the spline is drawn as just an outline whose thickness is determined by the Border Width slider.
Center X and Y
These controls adjust the position of the B-Spline mask.
Use the Size control to adjust the scale of the B-Spline effect mask, without affecting the relative behavior of the points that compose the mask or setting a keyframe in the mask animation.
X, Y, and Z Rotation
Use these three controls to adjust the rotation angle of the mask along any axis.
The Fill Method menu offers two different techniques for dealing with overlapping regions of a polyline. If overlapping segments in a mask are causing undesirable holes to appear, try switching the setting of this control from Alternate to Non Zero Winding.
Right-Click Here for Shape Animation
By default, all B-Spline masks are animated when they are created. The initial keyframe is set to the current time, and any changes to the shape at different times will create new keys.
Right-clicking on this label will display a contextual menu that offers options for removing or re-adding animation to the mask, or publishing and connecting the masks.
Adding Points to a B-Spline effect mask is relatively simple. Immediately after adding the node to the Node Editor, there are no points, but the tool will be in Click Append mode. Click once in the viewer wherever a point is required for the mask. Continue clicking to draw the shape of the mask.
When the shape is complete, click on the initial point again to close the mask.
When the shape is closed, the mode of the polyline changes to Insert and Modify. This allows you to add and adjust additional points on the mask by clicking the spline segments. To lock down the mask’s shape and prevent accidental changes, switch the Polyline mode to Done using the Polyline toolbar or contextual menu.
Adjusting Tension on a B-Spline
The tension of the control point determines the smoothness of a B-Spline. To adjust the tension of a B-Spline’s control points, select the point in the viewer, hold down the W key and drag the mouse pointer to the left and right to increase or decrease the tension of the curve through that point.
When a B-Spline mask is selected in the Node Editor, a toolbar appears above the viewer with buttons for easy access to the modes. Position the pointer over any button in the toolbar to display a tooltip that describes that button’s function.
You can change the way the toolbar is displayed by right-clicking on the toolbar and selecting from the options displayed in the toolbar’s contextual menu.
The functions of the buttons in this toolbar are explained in depth in the Polylines section.
B-Spline Mask Node Image and Settings Tabs
The Image and Settings tabs in the Inspector are also duplicated in other mask nodes. These common controls are described in detail HERE.
About the Author
Justin Robinson is a Certified DaVinci Resolve, Fusion & Fairlight instructor who is known for simplifying concepts and techniques for anyone looking to learn any aspect of the video post-production workflow. Justin is the founder of JayAreTV, a training and premade asset website offering affordable and accessible video post-production education. You can follow Justin on Twitter at @JayAreTV YouTube at JayAreTV or Facebook at MrJayAreTV