This discussion is locked
Kevin Brock

Q: I need a "Channel Combiner" node

I'm currently working through Steve Wright's book, Digital Compositing for Film and Video. He pitches this book as "application agnostic" - meaning you should be able to apply the techniques to most any compositing packages: Shake, AE, Digital Fusion, Nuke, etc. Steve has moved on to using Nuke nowadays but back when this book came out he was using Shake. So, to best play along, I've been using Shake to follow the book. (I had been wanting a Shake refresher anyway, as I haven't played with it in a couple of years.)

So anyway, there's a section that talks about despilling, or more precisely, in the exercise I'm hung on, UNspilling. I have most of his nodes figured out, except for the end. He's basically suggesting that you break out the individual color channels into separate nodes, perform some operations, then re-assemble the RGB channels into one image again. This last part has me stumped!

What I need is a node that basically says, "take the Red channel from this image, take the Green channel from this image, and take the Blue channel from this image". I just cannot figure it out. I'm pretty certain all my prior nodes are fine. But this final channel summing node is alluding me. A simple diagram I mocked up might look like this: (Using Mr. Wright's supplied images here.)



I found this article that makes explicit mention of the magical unspill node tree. In fact, they've included a diagram of their tree. However, it's so small I can't make much out of it.



Hopefully someone can help me unravel the final piece to this puzzle. I've killed a lot of time trying different combinations of other nodes. All to no avail.

FWIW, here's a copy/paste of my current script as exists: (minus the actual 'greenscreen.tif' file that I'm using to work through the example.)


greenscreen = SFileIn("./greenscreen.1-48#.tif",
"Auto", 0, 0, "v1.1", "0", "");
blue = ColorX(greenscreen, b, b, b, a, z);
green = ColorX(greenscreen, g, g, g, a, z);
red = ColorX(greenscreen, r, r, r, a, z);
average_RB = Mix(red, blue, 1, 50, "rgba");
spillmap = ISub(green, average_RB, 1, 100);
blue2 = ColorX(spillmap, b, b, b, a, z);
green2 = ColorX(spillmap, g, g, g, a, z);
red2 = ColorX(spillmap, r, r, r, a, z);
blue_scale = Lookup(blue2, JSplineV(x,1,0@0,1@1), JSplineV(x,1,0@0,1@1),
JSplineV(x,1,0@0,1@0.4), JSplineV(x,1,0@0,1@1));
green_scale = Lookup(green2, JSplineV(x,1,0@0,1@1), JSplineV(x,1,0@0,1@0.7),
JSplineV(x,1,0@0,1@1), JSplineV(x,1,0@0,1@1));
red_scale = Lookup(red2, JSplineV(x,1,0@0,1@0.25), JSplineV(x,1,0@0,1@1),
JSplineV(x,1,0@0,1@1), JSplineV(x,1,0@0,1@1));
IAdd1 = IAdd(blue_scale, blue, 1, 100);
IAdd2 = IAdd(red_scale, red, 1, 100);
ISub3 = ISub(green, green_scale, 1, 100);
Ignore(blue_scale);
Ignore(red_scale);
Ignore(green_scale);


Hopefully what I'm looking for makes sense to someone out there.

Mac Pro 2.8 8-core, 12" Powerbook G4, Mac OS X (10.5.8)

Posted on Jul 31, 2010 5:11 PM

Close

Q: I need a "Channel Combiner" node

  • All replies
  • Helpful answers

  • by stuckfootage,Solvedanswer

    stuckfootage stuckfootage Jul 31, 2010 9:38 PM in response to Kevin Brock
    Level 4 (3,040 points)
    Jul 31, 2010 9:38 PM in response to Kevin Brock
    I recognize that cute greenscreen girl! Steve Wright's book is excellent.
    To do a "color combiner", you just need two copy nodes.

    Text1 = Text(1920, 1080, 1, "Red", "Utopia Regular", 300,
    xFontScale/GetDefaultAspect(), 1, width/2, height/2, 0, 2,
    2, 1, 1, 1, 1, 0, 0, 0, 45, 0, 1);
    Text2 = Text(1920, 1080, 1, "Green", "Utopia Regular", 300,
    xFontScale/GetDefaultAspect(), 1, width/2, height/2, 0, 2,
    2, 1, 1, 1, 1, 0, 0, 0, 45, 0, 1);
    Text3 = Text(1920, 1080, 1, "Blue", "Utopia Regular", 300,
    xFontScale/GetDefaultAspect(), 1, width/2, height/2, 0, 2,
    2, 1, 1, 1, 1, 0, 0, 0, 45, 0, 1);
    Copy1 = Copy(Text1, Text2, 1, "gb", 0);
    Copy2 = Copy(Copy1, Text3, 1, "b", 0);
  • by Kevin Brock,

    Kevin Brock Kevin Brock Aug 1, 2010 4:34 PM in response to stuckfootage
    Level 4 (2,385 points)
    Aug 1, 2010 4:34 PM in response to stuckfootage
    Yes, the Steve Wright book is extraordinary. This guy knows his stuff!

    And the "copy" node certainly did the trick. That fixed it right up for me.

    Seeing the results you've produced, I'm still sort of trying to get my head around exactly what's going on. I know from the Shake Node Reference:[It] "Tells Shake what channels to copy from B to image A."I suppose the "A" and "B" and the 1st & 2nd node knots respectively? Little bit of head scratcher...

    Anyway, you solved my dilemma. I was getting frustrated trying to figure it out on my own.

    So thank you very much!
  • by stuckfootage,Helpful

    stuckfootage stuckfootage Aug 1, 2010 5:24 PM in response to Kevin Brock
    Level 4 (3,040 points)
    Aug 1, 2010 5:24 PM in response to Kevin Brock
    Kevin Brock wrote:
    "A" and "B" are the 1st & 2nd node knots respectively?


    Yes
  • by Kevin Brock,

    Kevin Brock Kevin Brock Aug 1, 2010 5:26 PM in response to stuckfootage
    Level 4 (2,385 points)
    Aug 1, 2010 5:26 PM in response to stuckfootage
    Thanks for the confirmation.
  • by Kevin Brock,

    Kevin Brock Kevin Brock Aug 3, 2010 8:34 AM in response to Kevin Brock
    Level 4 (2,385 points)
    Aug 3, 2010 8:34 AM in response to Kevin Brock
    So not long after posting my initial query here I clicked the "Contact" link associated with the book's online training material. I wasn't sure who this was going to. Steve Wright? And I had no idea if I'd receive a reply.

    Well, I did receive a reply, less than 24 hours later, from Steve himself! Nice.

    He gave me the complete unspill script, AND his was much less convoluted than mine...by a long shot. FWIW, here it is:

    GREENSCREEN = Reorder(0, "rgba");
    B = Reorder(GREENSCREEN, "bbb0");
    G = Reorder(GREENSCREEN, "ggg0");
    R = Reorder(GREENSCREEN, "rrr0");
    average_RB2 = Mix(R, B, 1, 50, "rgba");
    spillmap2 = ISub(G, average_RB2, 1, 100);
    scale_RGB = Lookup(spillmap2, JSplineV(x,1,0@0,0.173@0.9978),
    JSplineV(x,1,0@0,0.8538@0.7783), JSplineV(x,1,0@0,0.432@0.9774),
    JSplineV(x,1,0@0,1@1));
    G_only = Reorder(scale_RGB, "0g00");
    RB = Reorder(scale_RGB, "r0b0");
    Gmin_spillmapG = ISub(GREENSCREEN, G_only, 1, 100);
    RBplus_spillmapRB = IAdd(Gmin_spillmapG, RB, 1, 100);

    Thanks Steve Wright!
  • by Patrick Sheffield,

    Patrick Sheffield Patrick Sheffield Aug 4, 2010 10:55 AM in response to Kevin Brock
    Level 7 (29,175 points)
    Aug 4, 2010 10:55 AM in response to Kevin Brock
    What does adding back the RB do? I normally see the Gmin_spillmapG output... I don't get adding back the RB after it... also, why the scale_RGB? What is the significance of the values?

    Patrick

  • by Kevin Brock,

    Kevin Brock Kevin Brock Aug 4, 2010 1:22 PM in response to Patrick Sheffield
    Level 4 (2,385 points)
    Aug 4, 2010 1:22 PM in response to Patrick Sheffield
    Patrick,

    I think the general theory is (something like) this:

    The standard despill strategy is to build a green spill map, then subtract that from the green channel to remove the excess green from your shot. This certainly gets rid of some green from the shot, which is the goal. But since green is typically the brightest channel, this process can also darken the shot. Further, it can also introduce some hue shifts.

    The unspill strategy is a similar but different strategy. Instead of subtracting the green you add red & blue. But this only works properly with the scaling node in between the individual channels. Since we're adding some red + blue, we don't want to pull out as much green as before. So we can't use our original spill map at "full strength" on the green channel, like we did with a despill process. The scale_RGB (lookup) node lets us adjust how much each channel contributes to the spillmap before it's final calculations. The addition of the RB channels only works because of the scaling node upstream. We'd scale green down and red/blue up. The exact proportions would depend on the specific shot at hand.

    All in all, I think the despill vs. unspill processes are basically "Six Of One, A Half Dozen Of The Other". Different strategies to go at the same issue: removing spill.

    But because of the scaling lookup node there's a little more adjustability with the unspill method.

    Anyway, the specific scale_RGB values provided in the script-paste above are somewhat arbitrary. In the end, their real utility is twofold: you can use them to limit the green as you add red+blue - in the spillmap. Also they could be used to help "color" any fringing. If you have those tiny (annoying) edges on the key you might try eroding the matte to eliminate them. Not ideal. This scale_RGB node could, alternatively, be used to alter the colors of the fringe so that it mates up with it's background in a cleaner way. Color matching instead of matte eroding.

    Hope that all makes sense. I'm still trying to get my head around most of this stuff...