Jump to: Board index » General » Fusion

Copy Color Channel to Alpha Channel

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

Bernhard Rieder

  • Posts: 115
  • Joined: Tue Aug 04, 2015 6:49 pm

Copy Color Channel to Alpha Channel

PostWed Nov 15, 2017 4:06 pm

Having a black out.

How can you copy a simple color channel to an alpha channel?
Or... how can you transform a color channel into an alpha channel?

8bit.jpg contains color infos.. which I would like to use for the alpha channel to use it for a mask.

I looked into the Channel Boolean node.. but couldn't get it done. :?

Thank you very much for any little help,
appreciate it!
Offline

Ryan Bloomer

  • Posts: 765
  • Joined: Tue Jul 09, 2013 6:58 pm

Re: Copy Color Channel to Alpha Channel

PostWed Nov 15, 2017 6:24 pm

using a Channel Boolean (Bol) Copy the channel you want to use as a matte into the foreground alpha. Then use that as your matte.

Included is a simple example, replace the "RGB image with your 8bit.jpg. I'm subtracting the red channel in this example. Hope this helps:

Code: Select all
{
   Tools = ordered() {
      ChannelBooleans2 = ChannelBoolean {
         CtrlWZoom = false,
         Inputs = {
            ApplyMaskInverted = Input { Value = 1, },
            MultiplyByMask = Input { Value = 1, },
            Background = Input {
               SourceOp = "RGBimage",
               Source = "Output",
            },
            EffectMask = Input {
               SourceOp = "ChannelBooleans1",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 965.878, 148.128, }, },
      },
      RGBimage = ChannelBoolean {
         NameSet = true,
         Inputs = {
            Background = Input {
               SourceOp = "Merge2",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 697, 147, }, },
      },
      Merge2 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Merge1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Background1_2",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 496, 151, }, },
      },
      Background1_2 = Background {
         Inputs = {
            Width = Input { Value = 2048, },
            Height = Input { Value = 1556, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
            TopLeftBlue = Input { Value = 1, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1, },
                     [1] = { 1, 1, 1, 1, },
                  },
               },
            },
            EffectMask = Input {
               SourceOp = "Rectangle1_2",
               Source = "Mask",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 386, 151, }, },
      },
      Merge1 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Background1_1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 496, 118, }, },
      },
      Background1_1 = Background {
         Inputs = {
            Width = Input { Value = 2048, },
            Height = Input { Value = 1556, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
            TopLeftGreen = Input { Value = 1, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1, },
                     [1] = { 1, 1, 1, 1, },
                  },
               },
            },
            EffectMask = Input {
               SourceOp = "Rectangle1_1",
               Source = "Mask",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 386, 118, }, },
      },
      Rectangle1_2 = RectangleMask {
         Inputs = {
            MaskWidth = Input { Value = 2048, },
            MaskHeight = Input { Value = 1556, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Center = Input { Value = { 0.897111913357401, 0.5, }, },
            Height = Input { Value = 1.07957244655582, },
         },
         ViewInfo = OperatorInfo { Pos = { 224, 169, }, },
      },
      Rectangle1_1 = RectangleMask {
         Inputs = {
            MaskWidth = Input { Value = 2048, },
            MaskHeight = Input { Value = 1556, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Center = Input { Value = { 0.518050541516246, 0.5, }, },
            Height = Input { Value = 1.07957244655582, },
         },
         ViewInfo = OperatorInfo { Pos = { 237, 119, }, },
      },
      Background1 = Background {
         Inputs = {
            Width = Input { Value = 2048, },
            Height = Input { Value = 1556, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
            TopLeftRed = Input { Value = 1, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1, },
                     [1] = { 1, 1, 1, 1, },
                  },
               },
            },
            EffectMask = Input {
               SourceOp = "Rectangle1",
               Source = "Mask",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 386, 85, }, },
      },
      Rectangle1 = RectangleMask {
         Inputs = {
            MaskWidth = Input { Value = 2048, },
            MaskHeight = Input { Value = 1556, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Center = Input { Value = { 0.0722021660649819, 0.5, }, },
            Height = Input { Value = 1.07957244655582, },
         },
         ViewInfo = OperatorInfo { Pos = { 229, 34, }, },
      },
      ChannelBooleans1 = ChannelBoolean {
         Inputs = {
            ToRed = Input { Value = 4, },
            ToGreen = Input { Value = 4, },
            ToBlue = Input { Value = 4, },
            ToAlpha = Input { Value = 0, },
            Background = Input {
               SourceOp = "RGBimage",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 915.92, 13.4957, }, },
      },
   },
}
Offline
User avatar

Bryan Ray

  • Posts: 2491
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Copy Color Channel to Alpha Channel

PostWed Nov 15, 2017 7:16 pm

The Bitmap node is simplest—it will output a single-channel alpha from any of the input color channels, alpha, or luminance.
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

Ryan Bloomer

  • Posts: 765
  • Joined: Tue Jul 09, 2013 6:58 pm

Re: Copy Color Channel to Alpha Channel

PostWed Nov 15, 2017 9:09 pm

thanks Bryan, I forgot you can do it that way. Must less channel ordering with the bitmap.

Code: Select all
{
   Tools = ordered() {
      Bitmap1 = BitmapMask {
         CtrlWZoom = false,
         Inputs = {
            MaskWidth = Input { Value = 2048, },
            MaskHeight = Input { Value = 1556, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Image = Input {
               SourceOp = "RGBimage",
               Source = "Output",
            },
            Channel = Input { Value = FuID { "Red", }, },
         },
         ViewInfo = OperatorInfo { Pos = { 799, 90, }, },
      },
      ChannelBooleans2 = ChannelBoolean {
         Inputs = {
            ApplyMaskInverted = Input { Value = 1, },
            MultiplyByMask = Input { Value = 1, },
            Background = Input {
               SourceOp = "RGBimage",
               Source = "Output",
            },
            EffectMask = Input {
               SourceOp = "Bitmap1",
               Source = "Mask",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 916, 218, }, },
      },
      RGBimage = ChannelBoolean {
         NameSet = true,
         Inputs = {
            Background = Input {
               SourceOp = "Merge2",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 647.122, 216.872, }, },
      },
      Merge2 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Merge1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Background1_2",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 446.122, 220.872, }, },
      },
      Merge1 = Merge {
         Inputs = {
            Background = Input {
               SourceOp = "Background1",
               Source = "Output",
            },
            Foreground = Input {
               SourceOp = "Background1_1",
               Source = "Output",
            },
            PerformDepthMerge = Input { Value = 0, },
         },
         ViewInfo = OperatorInfo { Pos = { 446.122, 187.872, }, },
      },
      Background1 = Background {
         Inputs = {
            Width = Input { Value = 2048, },
            Height = Input { Value = 1556, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
            TopLeftRed = Input { Value = 1, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1, },
                     [1] = { 1, 1, 1, 1, },
                  },
               },
            },
            EffectMask = Input {
               SourceOp = "Rectangle1",
               Source = "Mask",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 336.122, 154.872, }, },
      },
      Background1_1 = Background {
         Inputs = {
            Width = Input { Value = 2048, },
            Height = Input { Value = 1556, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
            TopLeftGreen = Input { Value = 1, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1, },
                     [1] = { 1, 1, 1, 1, },
                  },
               },
            },
            EffectMask = Input {
               SourceOp = "Rectangle1_1",
               Source = "Mask",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 336.122, 187.872, }, },
      },
      Background1_2 = Background {
         Inputs = {
            Width = Input { Value = 2048, },
            Height = Input { Value = 1556, },
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
            TopLeftBlue = Input { Value = 1, },
            Gradient = Input {
               Value = Gradient {
                  Colors = {
                     [0] = { 0, 0, 0, 1, },
                     [1] = { 1, 1, 1, 1, },
                  },
               },
            },
            EffectMask = Input {
               SourceOp = "Rectangle1_2",
               Source = "Mask",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 336.122, 220.872, }, },
      },
      Rectangle1_2 = RectangleMask {
         Inputs = {
            MaskWidth = Input { Value = 2048, },
            MaskHeight = Input { Value = 1556, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Center = Input { Value = { 0.897111913357401, 0.5, }, },
            Height = Input { Value = 1.07957244655582, },
         },
         ViewInfo = OperatorInfo { Pos = { 174.122, 238.872, }, },
      },
      Rectangle1_1 = RectangleMask {
         Inputs = {
            MaskWidth = Input { Value = 2048, },
            MaskHeight = Input { Value = 1556, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Center = Input { Value = { 0.518050541516246, 0.5, }, },
            Height = Input { Value = 1.07957244655582, },
         },
         ViewInfo = OperatorInfo { Pos = { 187.122, 188.872, }, },
      },
      Rectangle1 = RectangleMask {
         Inputs = {
            MaskWidth = Input { Value = 2048, },
            MaskHeight = Input { Value = 1556, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Center = Input { Value = { 0.0722021660649819, 0.5, }, },
            Height = Input { Value = 1.07957244655582, },
         },
         ViewInfo = OperatorInfo { Pos = { 179.122, 103.872, }, },
      },
   },
}

Offline
User avatar

Bernhard Rieder

  • Posts: 115
  • Joined: Tue Aug 04, 2015 6:49 pm

Re: Copy Color Channel to Alpha Channel

PostWed Nov 15, 2017 11:11 pm

Hey.. THANK YOU SO MUCH - you guys simple rock!!!!

Return to Fusion

Who is online

Users browsing this forum: No registered users and 38 guests