Hello, just wanted to get your opinion on something:
http://littlemofo.soap.com.au/gamedev/color/
here you can see 4 colored circles over an image. The color of the circle changes the image underneath based on that color. Now does this seem correct to you guys? The blue color is very dark over yellow and red is very dark over blue and green is very dark over red. White is always the same.
I think its correct, but not sure. The effect I am trying to achieve is to have the color show up on top of every other color but I think this is going beyond simple multiplication.
The code is actually running from pixel bender, its implemented as a blendMode. Here is the pixel bender kernel, very straightforward.
Hopefully someone can understand my ramblingsCode:<languageVersion : 1.0;>
kernel ColorFilter
< namespace : "Flash";
vendor : "Chris Foulston";
version : 1;
description : "performs colour overlay blending";
>
{
input image4 background;
input image4 foreground;
output pixel4 result;
void evaluatePixel() {
float2 pos = outCoord();
pixel4 pix1 = sampleNearest(background, pos);
pixel4 pix2 = sampleNearest(foreground, pos);
float a = 1.0 - pix2.a;
float r = (pix1.r * a) + (pix1.r * pix2.r);
float g = (pix1.g * a) + (pix1.g * pix2.g);
float b = (pix1.b * a) + (pix1.b * pix2.b);
result = pixel4(r, g, b, pix1.a);
}
}
