What is the best way to turn turn off (using PixelBender) colors that fall within a certain range. For example, turn off all colors between 0x0000FF and 0x00FFFF. Thanks for your help. This has to work in Flash. Thanks!
Turn off color ranges in Pixel Bender
287 views Asked by Andrei Taraschuk At
2
There are 2 answers
1
On
If you mean per channel "between", here is a simple way to do it.
<languageVersion : 1.0;>
kernel untitled
< namespace : "Your Namespace";
vendor : "Your Vendor";
version : 1;
>
{
input image4 src;
output pixel4 dst;
parameter float rThreshold
<
minValue: 0.0;
maxValue: 1.0;
defaultValue: 0.0;
>;
parameter float gThreshold
<
minValue: 0.0;
maxValue: 1.0;
defaultValue: 0.0;
>;
parameter float bThreshold
<
minValue: 0.0;
maxValue: 1.0;
defaultValue: 0.0;
>;
void
evaluatePixel()
{
pixel4 sourcePixel = sampleNearest(src,outCoord());
if(sourcePixel.r <= rThreshold) sourcePixel.r = 0.0;
if(sourcePixel.g <= gThreshold) sourcePixel.g = 0.0;
if(sourcePixel.b <= bThreshold) sourcePixel.b = 0.0;
dst = sourcePixel;
}
}
Not sure whether this is the best way but it worked. The idea is to simulate uint color value in Pixel Bender.