Archive: saturation?


6th April 2006 21:00 UTC

saturation?
any hint how to increase the saturation of the colors of a preset? or will anybody do a tiny ape for this? ;)


6th April 2006 22:04 UTC

It probably isnt the best solution, or the fastest or the anything, but if you put:
level:
red=(red-(((1-red)+(1-green)+(1-blue))*0.33))*2;
green=(green-(((1-red)+(1-green)+(1-blue))*0.33))*2;
blue=(blue-(((1-red)+(1-green)+(1-blue))*0.33))*2;

into the colour modifier it maxes the saturation (sorta).....
^_^ I guess for a subtler effect you could do

red=((red-(((1-red)+(1-green)+(1-blue))*0.33))*2)*0.5+red*0.5;
green=((green-(((1-red)+(1-green)+(1-blue))*0.33))*2)*0.5+green*0.5;
blue=((blue-(((1-red)+(1-green)+(1-blue))*0.33))*2)*0.5+blue*0.

someone (not me...) needs to optimise this...


7th April 2006 05:41 UTC

The Color Modifier calculates red, green, and blue simultaneously. This means that, before the equation is processed, the "red", "green" and "blue" variables are set to the same values, so your code won't work the way it's intended to. That also means you can't mix channels with that effect.

Programming an APE to do this would work, assuming there's still anyone out there who knows how to program a decent APE.

For an effect similar to this, I think a "Color Map" could be a good approach. Use (R+G+B)/3 as the input, set the output to one of the "Subtractive" modes (I forget which is correct), and give it a black to gray gradient. (0,0,0 to 128,128,128.) This will make the image darker, so you'll want to follow that with a Trans/Multiplier (2x) to fix the brightness.

Alternatively, it might be possible to use the Trans/Colorfade effect to do the same thing, but, frankly, that thing scares me.


7th April 2006 10:18 UTC

You should be able to do it 'properly' with a color modifier. You need to convert the RGB to HSL, increase S and convert back to RGB. I have some code to convert HSL->RGB but not the other way around, I will paste it later when i get home (i might just write the color mod).


7th April 2006 14:18 UTC

it doesnt work with color mod since you cannot
use all three channels for calculations.
i.e. red=red*0.33+blue*0.33+green*0.33 wouldnt work.
and you need to use all three channels to convert rgb to hsb or hsv


7th April 2006 15:26 UTC

RGB -> HSL
HSL -> RGB


7th April 2006 15:30 UTC

Originally posted by StevenRoy
I think a "Color Map" could be a good approach. Use (R+G+B)/3 as the input, set the output to one of the "Subtractive" modes, give it a black to gray gradient. This will make the image darker, so you'll want to follow that with a Trans/Multiplier (2x) to fix the brightness.
Color Modifier can do sth like this all in one.

look into this CM, maybe it's what is needed, although the colors are reduced in this process [but that's inevitable when increasing saturation, afaik]

9th April 2006 00:20 UTC

cheers


9th April 2006 23:16 UTC

Color Modifier can't mix channels. That's the problem. It works like some paint programs' "Curves" function. You can alter brightness and contrast, gamma, invert, solarize (AKA "chrome"), posterize (AKA "color reduction"), and all sorts of similar effects, but you can't mix channels with Color Modifier!

Should I go into more detail about why this is?

For that reason, you also can't convert RGB to HSL in a Color Modifier, or back again. The closest you can come to increasing saturation would be increasing the contrast instead. (Although that could be close enough in most situations, as excellently demonstrated by the "saturation" preset posted above by Grandchild.)

Color Map, on the other hand, can do channel mixing. You can specify "(R+G+B)/3" as an input, and set the output mode to "Subtractive 1", which gives you something very close to the before-mentioned "(((1-red)+(1-green)+(1-blue))*0.33". From there, it's just a matter of finding the right gray value to get the effect you want, and then correcting the brightness afterward (equivalent to the *2 at the end of the equations Kar-mAVS posted here).

I'm attaching a preset that demonstrates this technique for increasing saturation. Note that it demonstrates three different strengths of the effect, too, and you can click the mouse to select them. This is explained a little more in the comment.

Hope this helps.


10th April 2006 12:37 UTC

oops, forgot about this. Yea I did the code for RGB->HSL->RGB in a colour mod but as people are pointing out it doesn't work.

You would have to paste the code into every place you do a render (assuming it is a codable component). I blame UnConeD for making colormod poo :P

Would be best as an APE as you suggested originally


11th April 2006 15:17 UTC

ok, i've got lots to learn here.
why does doing something like red=blue in colour modifier cause no change?
i was expecting the entire red channel to change.
obviously i am missing something.


12th April 2006 13:10 UTC

the magic words here are hidden in the

AVS Color Modifier - Expression Help:
"The color modifier allows you to modify the intensity of each color channel with respect to itself."
which means that red can only take the values of red for reference.

it might be more obvious when you know that the level box of the CMF is executed 256 times [pretty close to the number of color levels we have in RGB].

I assume it's working like that:
the first time the box gets evaluated it refers to all pixels that have: R=G=B=0. then it increases the reference-value by one each time the box gets evaluated.
Now you can work with the new value [1/255 in our case], then it steps up to 2/255, 3/255, 4/255, ... ,255/255=1.
But note, that at all time R=B=G is true!
So exchanging rgb is pointless in a CMF

See this post why it wouldn't be fast otherwise,
http://forums.winamp.com/showthread....32#post1844232

12th April 2006 21:07 UTC

i suck at expaining things but ill try anyway:).

code in color mods level box:

red=red*.2;
green=green*.6;
blue=blue*.5;

now some pseudo code on what happens:

for(i=0;i<256;i++)
{
red[i]=max(0,min(round(i*.2),255));
green[i]=max(0,min(round(i*.6),255));
blue[i]=max(0,min(round(i*.5),255));
}

then color mod goes over every pixel and does this:

red=red[red];
green=green[green];
blue=blue[blue];

this is as far as i can explain it:D.


13th April 2006 06:26 UTC

While we're all talking about colors, what's the square root of orange? :p


13th April 2006 07:26 UTC

what's the square root of orange?
16,11,0 :P