views:

36

answers:

2

Has anyone used the photo filter in Photoshop? Edit > Adjustments > Photo Filter...

It produces a really nice image tint that I've been unable to reproduce with blending modes. Has anyone got any idea of the pixel maths behind this filter? - So I can build a shader based on it.

It seems to basically be a luminosity preserving colour tint.

Has variables: Color, Amount and Preserve Luminosity.

Any ideas?

+1  A: 

Filters (in light) are multiplicative, as in:

red_filter = ( 1 , 0 , 0 ) * color

I don't think any blend-modes exist for it, since any transparent overlay with that system would darken the image to some degree.

TaslemGuy
There is a blend mode called "Multiply" that works exactly this way. Since it always darkens the image, you need another separate operation to restore the luminosity.
Mark Ransom
A: 

It's incredibly simple, but if anyone wants the hlsl code for this:

// Photoshop PhotoFilter style effect.

// Input filter color.
float4 FilterColor;

// Implicit texture sampler.
sampler TextureSampler : register(s0);

float4 PhotoFilter(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
    return tex2D(TextureSampler, texCoord) * FilterColor;
}

technique GeneralEffect
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PhotoFilter();
    }

}

Thank you for the help, it's much appreciated.

Rob