开发者

How could I implement a bleach bypass shader effect for WPF?

开发者 https://www.devze.com 2023-01-01 10:45 出处:网络
How could I implement a bleach bypass shader effect for WPF? I\'m also interested in the possibility of implementing the first two Tehnicolor 开发者_如何学运维Film Processes, or any variety that would

How could I implement a bleach bypass shader effect for WPF?

I'm also interested in the possibility of implementing the first two Tehnicolor 开发者_如何学运维Film Processes, or any variety that would result in an old film look.


Check out: http://developer.download.nvidia.com/shaderlibrary/packages/post_bleach_bypass.fx.zip

The important part is:

float4 bypassPS(QuadVertexOutput IN, uniform sampler2D SceneSampler) : COLOR
{
    float4 base = tex2D(SceneSampler, IN.UV);
    float3 lumCoeff = float3(0.25,0.65,0.1);
    float lum = dot(lumCoeff,base.rgb);
    float3 blend = lum.rrr;
    float L = min(1,max(0,10*(lum- 0.45)));
    float3 result1 = 2.0f * base.rgb * blend;
    float3 result2 = 1.0f - 2.0f*(1.0f-blend)*(1.0f-base.rgb);
    float3 newColor = lerp(result1,result2,L);
    float A2 = Opacity * base.a;
    float3 mixRGB = A2 * newColor.rgb;
    mixRGB += ((1.0f-A2) * base.rgb);
    return float4(mixRGB,base.a);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消