Thanks Chris,
But it looks like my code wasn't as bad as I thought. Yours works fine too but I still have a problem:

On high level of the threshold (0.9 --> 1) I get like trace effect. Similar to using an accumulator. The brightest part of the image seems to become transparent and the pixels accumulate underneath. Any idea why ?
Thanks
JeSs

Le 16 oct. 08 à 16:53, Chris Wood a écrit :

Off the top of my head (i.e. untested, but it should work ;) :

vec4 newpix = sample(image, samplerCoord(image));
return (newpix.r + newpix.g + newpix.b)/3.0 > threshold?
    (newpix - threshold) / (1.0 - threshold) :
    vec4(0.0,0.0,0.0,1.0);

(It first tests if r+g+b/3 is greater than the threshold. If it is, it reduces the value by the threshold value and then scales to 1.0, if not it returns black.)

Chris


2008/10/16 Jesse Lucas <[EMAIL PROTECTED]>
Hi List,

I'm trying to create a kind of threshold effect, but I'm very new to CI coding. Here's what I'm trying to achieve:

-I need to change all pixels under a certain brightness value to black. - And remap the brightness of the remain pixels to a 0 to 1 range (so I get contrast even on high threshold values).

- It doesn't matter if the resulting output is grayscale, I don't need the color information.

It is definitely not working right now so I need your help :)

Here's the code I've got for now (and I've attached the simple patch)
:

kernel vec4 threshhold(sampler image, float threshold)
{
       vec4 newpix = sample(image, samplerCoord(image));
       vec4 newpix = (newpix - threshold) / (1.0-threshold*1.1);
       newpix.a = 1.0;
       return vec4 (newpix);
}





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected] )
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/psonice%40gmail.com

This email sent to [EMAIL PROTECTED]


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to