Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Apel's gamma correction shader
- //tweakables
- static float gamma = 0.859;
- static float saturation = 1.0;
- static float luminance = 1.0;
- //tweakables
- texture lastshader;
- sampler s0 = sampler_state { texture = <lastshader>; minfilter = none; magfilter = none; };
- float3 grayscale(float3 col)
- {
- return dot(col.rgb, float3(0.3, 0.59, 0.11));
- }
- float4 gammatoo(float2 tex : TEXCOORD) : COLOR0
- {
- float3 c = tex2D(s0, tex).rgb;
- c = lerp(grayscale(c), c, saturation); // Apply saturation
- c = pow(c, gamma); // Apply gamma
- return float4(saturate(c * luminance ), 1.0);
- }
- technique T0 < string MGEinterface = "MGE XE 0"; >
- {
- pass { PixelShader = compile ps_3_0 gammatoo(); }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement