Advertisement
Guest User

Sharpen.fx

a guest
Apr 4th, 2015
1,175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Author: peachykeen
  2. // Title: Sharpen
  3. // Pack: MGE Shader Library
  4. // Desc:
  5. // Sharpens the image slightly
  6. // Patched for MGE XE by xackoff
  7.  
  8. texture lastpass;
  9.  
  10. sampler s0 = sampler_state { texture=<lastpass>; minfilter = linear; magfilter = linear; mipfilter = linear; addressu=clamp; addressv = clamp; };
  11.  
  12. vector rcpres;
  13.  
  14. float4 lSharp(in float2 Tex : TEXCOORD) : COLOR0
  15. {
  16.     float4 inColor = tex2D(s0, Tex);
  17.     float4 blur = inColor;
  18.  
  19.     blur += tex2D(s0, float2(Tex.x, Tex.y+rcpres.y)) * 0.25;
  20.     blur += tex2D(s0, float2(Tex.x, Tex.y-rcpres.y)) * 0.25;
  21.     blur += tex2D(s0, float2(Tex.x+rcpres.x, Tex.y)) * 0.25;
  22.     blur += tex2D(s0, float2(Tex.x-rcpres.x, Tex.y)) * 0.25;
  23.     blur += tex2D(s0, float2(Tex.x-rcpres.x, Tex.y+rcpres.y)) * 0.25;
  24.     blur += tex2D(s0, float2(Tex.x-rcpres.x, Tex.y-rcpres.y)) * 0.25;
  25.     blur += tex2D(s0, float2(Tex.x+rcpres.x, Tex.y+rcpres.y)) * 0.25;
  26.     blur += tex2D(s0, float2(Tex.x+rcpres.x, Tex.y-rcpres.y)) * 0.25;
  27.  
  28.     blur /= 3;
  29.  
  30.     float4 final = lerp(blur,inColor, 2); // Adjust sharpening strength here
  31.     return final;
  32. }
  33.  
  34. technique T0 < string MGEinterface="MGE XE 0"; >
  35. {
  36.     pass p0
  37.     {
  38.         PixelShader = compile ps_2_0 lSharp();
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement