Page 1 of 1

Erode Alpha

PostPosted: Thu Oct 01, 2015 2:27 pm
by Ryan Bloomer
I have a simple flow of an alpha channel file from another compositor, and want to refine his edge control. I'm trying to use the ErodeDilate node, but not able to apply the Edge contraction back to the original file. Only way I found to do it, is to add a second loader of the same file.... is there a better way to accomplish this?

Code: Select all
{
   Tools = ordered() {
      ChannelBooleans3 = ChannelBoolean {
         Inputs = {
            Operation = Input { Value = 4, },
            ToAlpha = Input { Value = 4, },
            Background = Input {
               SourceOp = "ErodeDilate1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 508.024, 318.672, }, },
      },
      Loader1_1 = Loader {
         Clips = {
            Clip {
               ID = "Clip1",
               Filename = "V:\\_AE render\\Acuity EP8\\Ch3_Cyborg_MED_shot_003\\Ch3_Cyborg_MED_shot_003_00000.tif",
               FormatID = "TiffFormat",
               Length = 356,
               LengthSetManually = true,
               TrimIn = 0,
               TrimOut = 355,
               ExtendFirst = 0,
               ExtendLast = 0,
               Loop = 1,
               AspectMode = 0,
               Depth = 0,
               TimeCode = 0,
               GlobalStart = 0,
               GlobalEnd = 355,
            },
         },
         Inputs = {
            MaskChannel = Input { Value = 5, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
            EffectMask = Input {
               SourceOp = "ChannelBooleans3",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 657.484, 319.931, }, },
      },
      ErodeDilate1 = ErodeDilate {
         CtrlWZoom = false,
         Inputs = {
            XAmount = Input { Value = -0.0009524, },
            Input = Input {
               SourceOp = "ChannelBooleans2",
               Source = "Output",
            },
            EffectMask = Input {
               SourceOp = "BSpline2",
               Source = "Mask",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 343.343, 314.45, }, },
      },
      BSpline2 = BSplineMask {
         DrawMode = "InsertAndModify",
         DrawMode2 = "InsertAndModify",
         Inputs = {
            SoftEdge = Input { Value = 0.027619, },
            Invert = Input { Value = 1, },
            MaskWidth = Input { Value = 1920, },
            MaskHeight = Input { Value = 1080, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Polyline = Input {
               SourceOp = "BSpline2Polyline",
               Source = "Value",
            },
            Polyline2 = Input {
               Value = BSplinePolyline {
                  Order = 4,
                  Type = "Tensioned",
                  Knots = { },
               },
               Disabled = true,
            },
         },
         ViewInfo = OperatorInfo { Pos = { 345.243, 256.73, }, },
      },
      BSpline2Polyline = BezierSpline {
         SplineColor = { Red = 173, Green = 255, Blue = 47, },
         NameSet = true,
         KeyFrames = {
            [529] = { 0, Flags = { Linear = true, LockedY = true, }, Value = BSplinePolyline {
                  Closed = true,
                  Points = {
                     { X = -0.113207545591515, Y = 0.530534338086616, },
                     { X = -0.119210977701544, Y = 0.315267175572519, },
                     { X = -0.0900843465545419, Y = 0.239122637770848, },
                     { X = -0.0138759442816881, Y = 0.191794393496039, },
                     { X = 0.0804970729165084, Y = 0.213122005307885, },
                     { X = 0.129152942009846, Y = 0.257131820492601, },
                     { X = 0.131217838765009, Y = 0.287786259541985, },
                     { X = 0.10548885077187, Y = 0.391603053435114, },
                     { X = 0.0900514579759862, Y = 0.452671755725191, },
                     { X = 0.0857632905244827, Y = 0.481679379940033, },
                     { X = 0.0257289879931389, Y = 0.512213740458015, },
                     { X = -0.0154373927958834, Y = 0.509160305343511, },
                  },
                  Order = 4,
                  Type = "Tensioned",
                  Knots = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, },
               }, },
         },
      },
      ChannelBooleans2 = ChannelBoolean {
         Inputs = {
            ToRed = Input { Value = 3, },
            ToGreen = Input { Value = 3, },
            ToBlue = Input { Value = 3, },
            ToAlpha = Input { Value = 4, },
            Background = Input {
               SourceOp = "Loader1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 185.353, 316.51, }, },
      },
      Loader1 = Loader {
         Clips = {
            Clip {
               ID = "Clip1",
               Filename = "V:\\_AE render\\Acuity EP8\\Ch3_Cyborg_MED_shot_003\\Ch3_Cyborg_MED_shot_003_00000.tif",
               FormatID = "TiffFormat",
               Length = 356,
               LengthSetManually = true,
               TrimIn = 0,
               TrimOut = 355,
               ExtendFirst = 0,
               ExtendLast = 0,
               Loop = 1,
               AspectMode = 0,
               Depth = 0,
               TimeCode = 0,
               GlobalStart = 0,
               GlobalEnd = 355,
            },
         },
         Inputs = {
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
         },
         ViewInfo = OperatorInfo { Pos = { 45.2017, 319.931, }, },
      },
   },
}

Re: Erode Alpha

PostPosted: Thu Oct 01, 2015 6:59 pm
by Rony Soussan
if the image has alpha already, then you can just add a matte control, blur and contract alpha, and then multiply the alpha again using radio button at the bottom.

If you don't, then you can feed the image with alpha into the green input, select copy as the mode, and then make your adjustments.

Re: Erode Alpha

PostPosted: Thu Oct 01, 2015 7:26 pm
by Ryan Bloomer
Thanks Rony this worked.

Still trying to come up with a good edge control method. Bluring with the matte control always seams to either eat in to the image too much, or extend too far out of the image (creating halos) I've been using a variable blur macro I wrote, to blur the background and foreground edges together to help get smoother edges. So essentially I was trying to get around not using the matte control for this purpose, but using the matte control does get around not having to import two loaders.

Re: Erode Alpha

PostPosted: Thu Oct 01, 2015 11:29 pm
by Rony Soussan
There are a few great macro's out there. Gringo had made a great edge tool for that.

I'll try to find it and post it for you.

Re: Erode Alpha

PostPosted: Fri Oct 02, 2015 4:38 pm
by Ryan Bloomer
Thanks again Rony for the lead,

A quick google search landed my on the link below, I'm guessing it's the one you're referring too. If there are others I would love to try them out. I haven't had a chance to try this macro out yet, but it looks great.

http://www.compositing.ru/Research/Tool ... storation/

Re: Erode Alpha

PostPosted: Fri Oct 02, 2015 4:44 pm
by Rony Soussan
That's the one. He has a ton of amazing solutions for download as well.

Re: Erode Alpha

PostPosted: Sat Oct 03, 2015 12:14 pm
by Stefan Ihringer
You should unpremultiply (AlphaDivide) your image before you shrink the alpha and post-multiply again. The ErodeDilate tool in Fusion 7+ has new filtering modes that are great for controlling how you eat into the matte. Blurring the alpha channel (for example by using the matte control tool) can quickly get you that "webbing" effect on concave corners.