Jump to: Board index » General » Fusion

Uneven jagged solid-ish edge on a mask

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

birdseye

  • Posts: 361
  • Joined: Fri Jun 12, 2020 2:36 pm
  • Real Name: Iain Fisher

Uneven jagged solid-ish edge on a mask

PostSun Feb 11, 2024 8:40 am

What is the most efficent way to achieve a fine uneven jagged solid-ish edge on a mask.I assume it's not by using hundreds of points, so I was thinking maybe it would need to be created as a parallel operation something like this. I'm not a compositor or anything close, so is there a trick you guys would use to achieve this? Only the top half and v shaped edge would be doing the useful masking. I'm guessing there must be a more handy way.

Code: Select all
{
   Tools = ordered() {
      Polygon1 = PolylineMask {
         DrawMode = "ModifyOnly",
         DrawMode2 = "ClickAppend",
         Inputs = {
            Filter = Input { Value = FuID { "Fast Gaussian" }, },
            PaintMode = Input { Value = FuID { "Add" }, },
            MaskWidth = Input { Value = 520, },
            MaskHeight = Input { Value = 720, },
            PixelAspect = Input { Value = { 1, 1 }, },
            ClippingMode = Input { Value = FuID { "None" }, },
            Center = Input { Value = { 0.512032085561497, 0.871428571428571 }, },
            Polyline = Input {
               Value = Polyline {
                  Closed = true,
                  Points = {
                     { Linear = true, X = -0.414846190501402, Y = -0.74558797173665, LX = 0.228181288717106, LY = 0.018882643858437, RX = 0.00632300003045968, RY = 0.187354650454463 },
                     { Linear = true, X = -0.395877190410023, Y = -0.18352402037326, LX = -0.00632300003045968, LY = -0.187354650454463, RX = 0.120322762739698, RY = -0.0537305980221172 },
                     { Linear = true, X = -0.0349089021909284, Y = -0.344715814439611, LX = -0.120322762739698, LY = 0.0537305980221172, RX = 0.100338071659269, RY = 0.0640469265295061 },
                     { Linear = true, X = 0.266105312786879, Y = -0.152575034851093, LX = -0.100338071659269, LY = -0.0640469265295061, RX = 0.00119745428767968, RY = -0.178788335103415 },
                     { Linear = true, X = 0.269697675649918, Y = -0.688940040161339, LX = -0.00119745428767968, LY = 0.178788335103415, RX = -0.228181288717106, RY = -0.018882643858437 }
                  }
               },
            },
            Polyline2 = Input {
               Value = Polyline {
               },
               Disabled = true,
            },
         },
         ViewInfo = OperatorInfo { Pos = { 100, -21.1212 } },
      },
      Instance_Polygon1 = PolylineMask {
         DrawMode = "ModifyOnly",
         DrawMode2 = "ClickAppend",
         FollowExtMatchPoints2 = false,
         SourceOp = "Polygon1",
         Inputs = {
            EffectMask = Input {
               SourceOp = "Polygon1",
               Source = "Mask",
            },
            SettingsNest = Input { },
            BorderWidth = Input { },
            Polyline2 = Input {
               Value = Polyline {
               },
               Disabled = true,
            },
            ["ShapeRasterizer.Nest"] = Input { },
            CommentsNest = Input { },
            FrameRenderScriptNest = Input { },
            StartRenderScripts = Input { },
            EndRenderScripts = Input { },
         },
         ViewInfo = OperatorInfo { Pos = { 100.666, 11.606 } },
      },
      Instance_Polygon1_1 = PolylineMask {
         DrawMode = "ModifyOnly",
         DrawMode2 = "ClickAppend",
         CtrlWZoom = false,
         SourceOp = "Polygon1",
         Inputs = {
            SettingsNest = Input { },
            BorderWidth = Input { },
            PaintMode = Input { Value = FuID { "Subtract" }, },
            Center = Input { Value = { 0.512032085561497, 0.844429 }, },
            Polyline2 = Input { Disabled = true, },
            ["ShapeRasterizer.Nest"] = Input { },
            CommentsNest = Input { },
            FrameRenderScriptNest = Input { },
            StartRenderScripts = Input { },
            EndRenderScripts = Input { },
            EffectMask = Input {
               SourceOp = "Instance_Polygon1",
               Source = "Mask",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 190.667, 11.6061 } },
      },
      image1 = Background {
         NameSet = true,
         Inputs = {
            GlobalOut = Input { Value = 500, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftRed = Input { Value = 1, },
         },
         ViewInfo = OperatorInfo { Pos = { 204.667, 50.3939 } },
      },
      image2 = Background {
         NameSet = true,
         Inputs = {
            GlobalOut = Input { Value = 500, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftBlue = Input { Value = 1, },
         },
         ViewInfo = OperatorInfo { Pos = { 204, 87.9697 } },
      },
      FastNoise1 = FastNoise {
         Inputs = {
            EffectMask = Input {
               SourceOp = "Instance_Polygon1_1",
               Source = "Mask",
            },
            GlobalOut = Input { Value = 500, },
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Detail = Input { Value = 10, },
            Contrast = Input { Value = 5, },
            LockXY = Input { Value = 0, },
            XScale = Input { Value = 960, },
         },
         ViewInfo = OperatorInfo { Pos = { 294.667, 12.2121 } },
      },
      Merge1 = Merge {
         CtrlWZoom = false,
         Inputs = {
            Background = Input {
               SourceOp = "image2",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "LumaKeyer1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 316, 87.0303 } },
      },
      LumaKeyer1 = LumaKeyer {
         Inputs = {
            EffectMask = Input {
               SourceOp = "FastNoise1",
               Source = "Output",
            },
            Low = Input { Value = 0.694, },
            Filter = Input { Value = FuID { "Fast Gaussian" }, },
            Input = Input {
               SourceOp = "image1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 316, 51 } },
      }
   },
   ActiveTool = "Merge1"
}
Offline

Sander de Regt

  • Posts: 3591
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Uneven jagged solid-ish edge on a mask

PostSun Feb 11, 2024 8:56 am

I've seen a lot of people using the mask first to mask out a black/white matte that can then be adjusted with a displacement node to make the edges more jagged. You can then use the result of that as a bitmap mask to do your actual masking.

Is this what you're after?

Code: Select all
{
   Tools = ordered() {
      Polygon2 = PolylineMask {
         DrawMode = "InsertAndModify",
         DrawMode2 = "InsertAndModify",
         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" }, },
            Polyline = Input {
               SourceOp = "Polygon2Polyline",
               Source = "Value",
            },
            Polyline2 = Input {
               Value = Polyline {
               },
               Disabled = true,
            },
         },
         ViewInfo = OperatorInfo { Pos = { 770, -115.5 } },
      },
      Polygon2Polyline = BezierSpline {
         SplineColor = { Red = 173, Green = 255, Blue = 47 },
         CtrlWZoom = false,
         NameSet = true,
         KeyFrames = {
            [0] = { 0, Flags = { Linear = true, LockedY = true }, Value = Polyline {
                  Closed = true,
                  Points = {
                     { Linear = true, X = -0.279883381924198, Y = 0.0336787564766839, LX = -0.032312925170068, LY = -0.216753022452504, RX = 0.129737609329446, RY = -0.0651986183074266 },
                     { Linear = true, X = 0.10932944606414, Y = -0.161917098445596, LX = -0.129737609329446, LY = 0.0651986183074266, RX = 0.086734693877551, RY = 0.075993091537133 },
                     { Linear = true, X = 0.369533527696793, Y = 0.0660621761658031, LX = -0.086734693877551, LY = -0.075993091537133, RX = 0.00437317784256558, RY = -0.125215889464594 },
                     { Linear = true, X = 0.38265306122449, Y = -0.309585492227979, LX = -0.00437317784256558, LY = 0.125215889464594, RX = 0.0225947521865889, RY = -0.0781519861830743 },
                     { Linear = true, X = 0.450437317784257, Y = -0.544041450777202, LX = -0.0225947521865889, LY = 0.0781519861830743, RX = -0.27575315840622, RY = -0.0241796200345423 },
                     { Linear = true, X = -0.376822157434402, Y = -0.616580310880829, LX = 0.27575315840622, LY = 0.0241796200345423, RX = 0.032312925170068, RY = 0.216753022452504 }
                  }
               } }
         }
      },
      FastNoise2 = FastNoise {
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            Detail = Input { Value = 10, },
            Contrast = Input { Value = 1.89, },
            XScale = Input { Value = 20, },
         },
         ViewInfo = OperatorInfo { Pos = { 935, -115.5 } },
      },
      Displace1 = Displace {
         Inputs = {
            Type = Input { Value = 1, },
            XRefraction = Input { Value = -0.022, },
            YChannel = Input { Value = 4, },
            YRefraction = Input { Value = 0.014, },
            LightChannel = Input { Value = 5, },
            Input = Input {
               SourceOp = "BackgroundForMask",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "FastNoise2",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 935, -49.5 } },
      },
      BackgroundForMask = Background {
         NameSet = true,
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftRed = Input { Value = 1, },
            TopLeftGreen = Input { Value = 1, },
            TopLeftBlue = Input { Value = 1, },
            EffectMask = Input {
               SourceOp = "Polygon2",
               Source = "Mask",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 770, -49.5 } },
      },
      BitmapThatDoesTheActualMasking = BitmapMask {
         NameSet = true,
         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" }, },
            Image = Input {
               SourceOp = "Displace1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 935, -16.5 } },
      },
      Background1 = Background {
         CtrlWZoom = false,
         Inputs = {
            Width = Input { Value = 1920, },
            Height = Input { Value = 1080, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
            TopLeftGreen = Input { Value = 1, },
            EffectMask = Input {
               SourceOp = "BitmapThatDoesTheActualMasking",
               Source = "Mask",
            }
         },
         ViewInfo = OperatorInfo { Pos = { 1100, 16.5 } },
      }
   }
}
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline

birdseye

  • Posts: 361
  • Joined: Fri Jun 12, 2020 2:36 pm
  • Real Name: Iain Fisher

Re: Uneven jagged solid-ish edge on a mask

PostSun Feb 11, 2024 10:37 am

That looks very promising, I will mess about with a few ideas. What is it for? - well lets say you have tall grass and want to shorten it or long hair and want shorten it.. Rather than using a blurred constant edge, which looks like, a blurred constant edge, it should look better if the edge was a bit random. The problem might be if the grass or hair moves the masked image should really affect the edge in some way, so some element of the original image affecting the edge would be ideal.
Offline

Sander de Regt

  • Posts: 3591
  • Joined: Thu Nov 13, 2014 10:09 pm

Re: Uneven jagged solid-ish edge on a mask

PostSun Feb 11, 2024 10:41 am

Well you can use (altered versions) of the original footage to drive these displacements instead of the fast noise, so you have options. :)
Sander de Regt

ShadowMaker SdR
The Netherlands
Offline

birdseye

  • Posts: 361
  • Joined: Fri Jun 12, 2020 2:36 pm
  • Real Name: Iain Fisher

Re: Uneven jagged solid-ish edge on a mask

PostSun Feb 11, 2024 10:44 am

Thanks Sander, I will play around with that method later and I might learn something.

Return to Fusion

Who is online

Users browsing this forum: No registered users and 49 guests