Page 1 of 1

Applying a mask to multiple (merged) elements

PostPosted: Mon Dec 03, 2018 4:19 pm
by byte12
I've combined two lines of 2D text using a Merge node. How can I apply a gradient mask to them? As in: ensure that all text gradually fades from full opacity to full transparency.

I noticed that when I attach a gradient Background node to the Merge node, that it only applies to the second bit of text. How do I apply it to both?

Re: Applying a mask to multiple (merged) elements

PostPosted: Mon Dec 03, 2018 7:18 pm
by Sander de Regt
You can also apply a gradient direcly to the Text 2D itself in the shading tab. That might be more easy in this case?

If not, just let us know and I'm sure someone will help you out.

Re: Applying a mask to multiple (merged) elements

PostPosted: Mon Dec 03, 2018 7:43 pm
by byte12
I see what you mean, but I want to animate it later. I want to create that gradually "reveals" itself by means of a moving gradient mask.

I wonder what happens if I use a Merge node with only the Foreground and Mask inputs connected...

Re: Applying a mask to multiple (merged) elements

PostPosted: Mon Dec 03, 2018 8:19 pm
by Okke Verbart
Hi Pieter - sounds what you're doing is that you're masking out the foreground. You probably hooked up the background node to the effect mask input. This input is normally used to mask the foreground. So, it would only mask out the text+ node that is set as the foreground.

What you can do (there are many other ways though), is to add a brightness/contrast after the merge output. Tick alpha, and set the gain to zero. Then add a rectangular mask, add softness and animate it.

See example below (just copy & paste into a comp, display the brightness/contrast node in the viewer and hit play)

Code: Select all
{
   Tools = ordered() {
      Text1 = TextPlus {
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input { Value = "ONE", },
            Style = Input { Value = "Bold", },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 632, 131 } },
      },
      Rectangle1 = RectangleMask {
         Inputs = {
            SoftEdge = Input { Value = 0.0812, },
            MaskWidth = Input { Value = 1920, },
            MaskHeight = Input { Value = 1080, },
            PixelAspect = Input { Value = { 1, 1 }, },
            ClippingMode = Input { Value = FuID { "None" }, },
            Center = Input {
               SourceOp = "Path1",
               Source = "Position",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 898, 46 } },
      },
      Path1 = PolyPath {
         DrawMode = "InsertAndModify",
         Inputs = {
            Displacement = Input {
               SourceOp = "Path1Displacement",
               Source = "Value",
            },
            PolyLine = Input {
               Value = Polyline {
                  Points = {
                     { Linear = true, LockY = true, X = 0, Y = -0.0148148148148148, RX = 0, RY = 0.109259259259259 },
                     { Linear = true, LockY = true, X = 0, Y = 0.312962962962963, LX = 0, LY = -0.109259259259259 }
                  }
               },
            },
         },
      },
      Path1Displacement = BezierSpline {
         SplineColor = { Red = 255, Green = 0, Blue = 255 },
         NameSet = true,
         KeyFrames = {
            [0] = { 0, RH = { 19.3333333333333, 0.333333333333333 }, Flags = { Linear = true, LockedY = true } },
            [58] = { 1, LH = { 38.6666666666667, 0.666666666666667 }, Flags = { Linear = true, LockedY = true } }
         }
      },
      BrightnessContrast1 = BrightnessContrast {
         CtrlWZoom = false,
         Inputs = {
            Alpha = Input { Value = 1, },
            Gain = Input { Value = 0, },
            Input = Input {
               SourceOp = "Merge1",
               Source = "Output",
            },
            EffectMask = Input {
               SourceOp = "Rectangle1",
               Source = "Mask",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 901, 161 } },
      },
      Merge1 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Text1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Text2",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 791, 161 } },
      },
      Text2 = TextPlus {
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Center = Input { Value = { 0.5, 0.418518518518519 }, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input { Value = "TWO", },
            Style = Input { Value = "Bold", },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
         },
         ViewInfo = OperatorInfo { Pos = { 631, 164 } },
      }
   },
   ActiveTool = "BrightnessContrast1"
}

Re: Applying a mask to multiple (merged) elements

PostPosted: Mon Dec 03, 2018 9:47 pm
by Bryan Ray
byte12 wrote:I wonder what happens if I use a Merge node with only the Foreground and Mask inputs connected...


You'll get an error since the Merge requires a Background to set its format. You could put a black, 0 alpha Background node in the Background input of the Merge, though, to give you an empty canvas on which to work.

Another method is to connect your mask to the Effect Mask input of both Text nodes. That won't work so well if you're doing any transformations of the text after the generator itself since the mask will be transformed right along with the text. That looks like this:

Code: Select all
{
   Tools = ordered() {
      Rectangle1 = RectangleMask {
         CtrlWZoom = false,
         Inputs = {
            MaskWidth = Input { Value = 1920, },
            MaskHeight = Input { Value = 1080, },
            PixelAspect = Input { Value = { 1, 1 }, },
            ClippingMode = Input { Value = FuID { "None" }, },
            Center = Input { Value = { 0.245827984595635, 0.5 }, },
         },
         ViewInfo = OperatorInfo { Pos = { 440, 82.5 } },
      },
      Text2 = TextPlus {
         Inputs = {
            GlobalIn = Input { Value = 1, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Center = Input { Value = { 0.5, 0.45662100456621 }, },
            Size = Input { Value = 0.1368, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input { Value = "Two Fish", },
            Style = Input { Value = "Bold", },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
            Red1 = Input { Value = 0.048616, },
            Green1 = Input { Value = 0.048616, },
            Blue1 = Input { Value = 0.472, },
            EffectMask = Input {
               SourceOp = "Rectangle1",
               Source = "Mask",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 605, 115.5 } },
      },
      Text1 = TextPlus {
         Inputs = {
            GlobalIn = Input { Value = 1, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Center = Input { Value = { 0.5, 0.53972602739726 }, },
            Size = Input { Value = 0.192, },
            Font = Input { Value = "Open Sans", },
            StyledText = Input { Value = "One Fish", },
            Style = Input { Value = "Bold", },
            ManualFontKerningPlacement = Input {
               Value = StyledText {
                  Array = {
                  },
                  Value = ""
               },
            },
            Red1 = Input { Value = 0.336, },
            Green1 = Input { Value = 0.00672000000000001, },
            Blue1 = Input { Value = 0.00840000000000019, },
            EffectMask = Input {
               SourceOp = "Rectangle1",
               Source = "Mask",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 605, 82.5 } },
      },
      Merge2 = Merge {
         Inputs = {
            UseOpenCL = Input { Value = 0, },
            Background = Input {
               SourceOp = "Text1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Text2",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 715, 115.5 } },
      }
   }
}

Re: Applying a mask to multiple (merged) elements

PostPosted: Wed Dec 05, 2018 4:57 pm
by byte12
Bryan Ray wrote:You'll get an error since the Merge requires a Background to set its format. You could put a black, 0 alpha Background node in the Background input of the Merge, though, to give you an empty canvas on which to work.

That did the trick for me, thanks!

Re: Applying a mask to multiple (merged) elements

PostPosted: Sat Dec 08, 2018 7:54 am
by TinaNamdev
I noticed that when I attach a gradient Background node to the Merge node