disappear.fx 809 B

12345678910111213141516171819202122232425262728293031
  1. // Effect uses a scrolling overlay texture to make different parts of
  2. // an image fade in or out at different speeds.
  3. float2 OverlayScroll;
  4. sampler TextureSampler : register(s0);
  5. sampler OverlaySampler : register(s1);
  6. float4 main(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
  7. {
  8. // Look up the texture color.
  9. float4 tex = tex2D(TextureSampler, texCoord);
  10. // Look up the fade speed from the scrolling overlay texture.
  11. float fadeSpeed = tex2D(OverlaySampler, OverlayScroll + texCoord).x;
  12. // Apply a combination of the input color alpha and the fade speed.
  13. tex *= saturate((color.a - fadeSpeed) * 2.5 + 1);
  14. return tex;
  15. }
  16. technique Desaturate
  17. {
  18. pass Pass1
  19. {
  20. PixelShader = compile ps_2_0 main();
  21. }
  22. }