Skip to content

Instantly share code, notes, and snippets.

@Xibanya
Created August 8, 2016 16:49
Show Gist options
  • Save Xibanya/186537a45892039fce24797835c05149 to your computer and use it in GitHub Desktop.
Save Xibanya/186537a45892039fce24797835c05149 to your computer and use it in GitHub Desktop.
simple fade shader
sampler ColorMapSampler : register(s0);
float filterRed;
float filterGreen;
float filterBlue;
float amount;
float4 PixelShaderFunction(float2 TextureCoordinate : TEXCOORD0) : COLOR0
{
float4 color = tex2D(ColorMapSampler, TextureCoordinate);
color.r = lerp(filterRed / 255, color.r, amount);
color.g = lerp(filterGreen / 255, color.g, amount);
color.b = lerp(filterBlue / 255, color.b, amount);
return color;
}
technique Fade
{
pass
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment