Chroma key and thresholding in Flash (Pixel Bender), revised

December 10th, 2009  |  Published in Uncategorized  |  8 Comments

yellowFiltered

>>Demo<< (Click to toggle filter)

source (Flex project including pbk)

I have been very busy since the last few weeks… so the chroma key filter was put aside for a long time until today :)

I have used conditional compile in the filter to avoid having if-else in the runtime, hopefully can increase performance… Anyone volunteer to measure it and post the different?

Tags: , ,

Responses

  1. Tweets that mention Chroma key and thresholding in Flash (Pixel Bender), revised | Andy Li's Blog -- Topsy.com says:

    December 11th, 2009 at 2:14 am (#)

    [...] This post was mentioned on Twitter by Adobe Pixel Bender, Andy Li. Andy Li said: New blog post: Chroma key and thresholding in Flash (Pixel Bender), revised http://bit.ly/5mu0kC [...]

  2. Kasper Kamperman says:

    January 20th, 2010 at 5:25 am (#)

    Make sure if you want to use this filter in Flash to install a new version ( 1.5 ) of PixelBender.
    I tried to export it for Flash with version 1.0.352475 ( included with CS4 ) and the filter gave a strange output ( not in the pixel bender environment itself ).

    With version 1.5 the filter works correctly in Flash as well.

  3. FLARtoolkit trick: use a colored marker | Andy Li's Blog says:

    January 28th, 2010 at 3:34 pm (#)

    [...] Here I have a PB kernel that works with any color. Try it! [...]

  4. Juan Herrera says:

    June 14th, 2010 at 2:21 am (#)

    When trying to compile I get this error:

    public function get colorImage():DisplayObject {
    return tabNav.selectedChild;
    }

    Implicit coercion of a value of type mx.core:INavigatorContent to an unrelated type flash.display:DisplayObject. What might be wrong?

  5. Juan Herrera says:

    June 14th, 2010 at 2:49 am (#)

    Got it. For flex 4 must change

    tabNav.selectedChild;

    to

    Container(tabNav.selectedChild);

    What should be done to get a color image instead of a b/w mask?

  6. Andy says:

    June 14th, 2010 at 12:18 pm (#)

    @Juan
    If look into the source of the kernel, there are “outputColor0UseInputColor” and “outputColor1UseInputColor” params.

    You can set one of them as true and set the other outputColor as transparent, finally put another image at the bottom of the filtered image.

  7. Juan Herrera says:

    July 7th, 2010 at 1:27 am (#)

    You mean, like

    ChromaKey_hsv_combineChannelShader.data.outputColor0UseInputColor.value[0] = 1;
    ChromaKey_hsv_combineChannelShader.data.outputColor1.value[0] = 1.0;
    ChromaKey_hsv_combineChannelShader.data.outputColor1.value[1] = 1.0;
    ChromaKey_hsv_combineChannelShader.data.outputColor1.value[2] = 1.0;
    ChromaKey_hsv_combineChannelShader.data.outputColor1.value[3] = 0.0;

    I can’t seem to make it work. I’m trying to make a button show behind the chroma like this:

    What could be wrong? Thanks

  8. Juan Herrera says:

    July 7th, 2010 at 1:30 am (#)

    (reposting; tags were filtered in previous post)
    You mean, like

    ChromaKey_hsv_combineChannelShader.data.outputColor0UseInputColor.value[0] = 1;
    ChromaKey_hsv_combineChannelShader.data.outputColor1.value[0] = 1.0;
    ChromaKey_hsv_combineChannelShader.data.outputColor1.value[1] = 1.0;
    ChromaKey_hsv_combineChannelShader.data.outputColor1.value[2] = 1.0;
    ChromaKey_hsv_combineChannelShader.data.outputColor1.value[3] = 0.0;

    I can’t seem to make it work. I’m trying to make a button show behind the chroma like this:

    mx:Canvas blendMode=”layer”
    mx:Button label=”my button”/
    mx:Image source=”@Embed(‘colors.png’)” blendMode=”alpha”/
    /mx:Canvas

    What could be wrong?

Leave a Response