Jump to: Board index » General » Fusion

Material and Object ID masking

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

Ryan Bloomer

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

Material and Object ID masking

PostThu Sep 24, 2015 8:16 pm

I had this working awhile ago and think I must have moved something in my flow, as I can't get masking to work from a Material ID render pass from a 3D render. i have the Material ID render pass piped into a ChannelBooleans, and out put to a bitmap mask, and the bit map mask into a mask of the object I want maked by the color information of the material ID render.... anything I'm missing?

Code: Select all
{
   Tools = ordered() {
      ChannelBooleans1_1 = ChannelBoolean {
         CtrlWZoom = false,
         Inputs = {
            ToRed = Input { Value = 4, },
            ToGreen = Input { Value = 4, },
            ToBlue = Input { Value = 4, },
            ToAlpha = Input { Value = 4, },
            EnableExtraChannels = Input { Value = 1, },
            ToObjectID = Input { Value = 9, },
            ToMaterialID = Input { Value = 11, },
            Background = Input {
               SourceOp = "Loader2",
               Source = "Output",
            },
         },
         ViewInfo = OperatorInfo { Pos = { 804.909, -92.861, }, },
      },
      Loader2 = Loader {
         Clips = {
            Clip {
               ID = "Clip1",
               Filename = "V:\\_3D render\\Acuity_EP9and10\\Acuity_EP9and10_Intro\\Dp9_Intro_Renders_0825\\Ani_shot_001_v1_MatIDandZdepth_00000000.psd",
               FormatID = "PSDFormat",
               Length = 38,
               LengthSetManually = true,
               TrimIn = 0,
               TrimOut = 37,
               ExtendFirst = 0,
               ExtendLast = 0,
               Loop = 1,
               AspectMode = 0,
               Depth = 0,
               TimeCode = 0,
               GlobalStart = 0,
               GlobalEnd = 37,
            },
         },
         Inputs = {
            ["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2", }, },
            ["Clip1.PSDFormat.Layer"] = Input { Value = 2, },
         },
         ViewInfo = OperatorInfo { Pos = { 784.209, -148.525, }, },
      },
      Bitmap2 = BitmapMask {
         Inputs = {
            MaskWidth = Input { Value = 1920, },
            MaskHeight = Input { Value = 1080, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Image = Input {
               SourceOp = "ChannelBooleans1_1",
               Source = "Output",
            },
            Channel = Input { Value = FuID { "Luminance", }, },
            UseObject = Input { Value = 1, },
            UseMaterial = Input { Value = 1, },
            Object = Input { Value = 54614, },
            Material = Input { Value = 21844, },
         },
         ViewInfo = OperatorInfo { Pos = { 826.812, -49.2468, }, },
      },
   },
}
Offline
User avatar

Chad Capeland

  • Posts: 3025
  • Joined: Mon Nov 10, 2014 9:40 pm

Re: Material and Object ID masking

PostThu Sep 24, 2015 9:58 pm

Does your image contain a MatID channel?
Chad Capeland
Indicated, LLC
www.floweffects.com
Offline

Ryan Bloomer

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

Re: Material and Object ID masking

PostFri Sep 25, 2015 2:45 pm

Hey Chad, I'ts not an EXR, so it's not a channel per say. it's just an RGB image rendered with different colors for the MatIDs.

I found I needed to change the Bitmap Mask to "Alpha" not "luminance" and now it's working. Although I get really rough edges in the mask. I'm guessing I need to render out 32bpc rather than 16 for this to work.

Code: Select all
{
   Tools = ordered() {
      Bitmap2 = BitmapMask {
         CtrlWZoom = false,
         Inputs = {
            Invert = Input { Value = 1, },
            MaskWidth = Input { Value = 1920, },
            MaskHeight = Input { Value = 1080, },
            PixelAspect = Input { Value = { 1, 1, }, },
            ClippingMode = Input { Value = FuID { "None", }, },
            Image = Input {
               SourceOp = "ChannelBooleans1_1",
               Source = "Output",
            },
            UseObject = Input { Value = 1, },
            UseMaterial = Input { Value = 1, },
            Object = Input { Value = 62416, },
            Material = Input { Value = 65534, },
         },
         ViewInfo = OperatorInfo { Pos = { 697.11, -80.285, }, },
      },
      ChannelBooleans1_1 = ChannelBoolean {
         Inputs = {
            ToRed = Input { Value = 4, },
            ToGreen = Input { Value = 4, },
            ToBlue = Input { Value = 4, },
            ToAlpha = Input { Value = 4, },
            EnableExtraChannels = Input { Value = 1, },
            ToObjectID = Input { Value = 9, },
            ToMaterialID = Input { Value = 11, },
         },
         ViewInfo = OperatorInfo { Pos = { 546.096, -109.014, }, },
      },
   },
}
Attachments
MatID-bitmapMask.JPG
MatID-bitmapMask.JPG (19 KiB) Viewed 2436 times
Offline
User avatar

Chad Capeland

  • Posts: 3025
  • Joined: Mon Nov 10, 2014 9:40 pm

Re: Material and Object ID masking

PostFri Sep 25, 2015 6:53 pm

MatID's are uint16 in Fusion. The precision of a float image isn't going to matter much if the values you are pulling (saturation and hue in this case) vary on the image because of filtering or imprecision in the rasterization.

The concept is basically flawed, you can't really do much unless you are OK with rough masks, like for soft glows, and since you aren't providing BG pixels or coverage channels, your edges will never look good.

You probably will have better luck keying the color you want or using a wand mask. Or go back and render proper ID and coverage and maybe even BG passes.
Chad Capeland
Indicated, LLC
www.floweffects.com

Return to Fusion

Who is online

Users browsing this forum: Tim Hitchen and 29 guests