-
M.D.
Color Math
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.
Code:
<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);
}
}
Hopefully someone can understand my ramblings
Last edited by mr_malee; 09-10-2009 at 09:44 AM.
-
Dance Monkey Dance!
Looks fine here, isn't there a way you could produce the image in red green and blue in something like photoshop and check your results against that?
"I layed down in my bed last night looked up at the stars, and thought to myself... Where the F*#K is my roof"
-
Senior Member
Wikipedia's entry is confusing: http://en.wikipedia.org/wiki/Blend_modes#Overlay
Originally Posted by wikipedia
Overlay combines Multiply and Screen blend modes. Light parts of the picture become lighter and dark parts become darker. An overlay with the same picture looks like an S-curve.
And they give definitions for Multiply and Screen but I am confused what they mean by "combine". (I mean, I suppose it could just be the result of the first is the background of the other, but seems ambiguous to me)
-
Hype over content...
I think the blue is very dark over the flower because there's very little blue in that part of the image ( It's fine up against the blue wall for example ).
If it's just pulling out the amount of that colour underneath it, then 'cause it's pulling out very little blue you're left with a "low" amount of blue, which makes it so dark.
Squize.
-
M.D.
yeah, I'm trying to add blue (red or green too) to a color. As if a colored light was pointed at the image.
-
ism
desaturate it, then add the colour
Graphics Attract, Motion Engages, Gameplay Addicts
XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro
-
Senior Member
I think the blue is too dark, rest is ok!
If you like me, add me to your friends list .
PS: looking for spriters and graphics artists for a RPG and an Arcade fighting project. If you can help out, please pm me!
My Arcade My Blog
Add me on twitter:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|