Sharpen.shader 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. Shader "SupGames/Shaders/Sharpen"
  2. {
  3. Properties
  4. {
  5. _MainTex("Base (RGB)", 2D) = "" {}
  6. }
  7. CGINCLUDE
  8. #include "UnityCG.cginc"
  9. struct appdata {
  10. half4 pos : POSITION;
  11. half2 uv : TEXCOORD0;
  12. };
  13. struct v2f
  14. {
  15. half4 pos : SV_POSITION;
  16. half2 uv : TEXCOORD0;
  17. half4 uv1 : TEXCOORD1;
  18. };
  19. uniform sampler2D _MainTex;
  20. uniform half _CentralFactor;
  21. uniform half _SideFactor;
  22. uniform half4 _MainTex_TexelSize;
  23. v2f vert(appdata v)
  24. {
  25. v2f o;
  26. o.pos = UnityObjectToClipPos(v.pos);
  27. o.uv = v.uv;
  28. o.uv1 = half4(v.uv - _MainTex_TexelSize.xy, v.uv + _MainTex_TexelSize.xy);
  29. return o;
  30. }
  31. half4 frag(v2f i) : SV_Target
  32. {
  33. half4 c = tex2D(_MainTex, i.uv) * _CentralFactor;
  34. c -= tex2D(_MainTex, i.uv1.xy) * _SideFactor;
  35. c -= tex2D(_MainTex, i.uv1.xw) * _SideFactor;
  36. c -= tex2D(_MainTex, i.uv1.zy) * _SideFactor;
  37. c -= tex2D(_MainTex, i.uv1.zw) * _SideFactor;
  38. return c;
  39. }
  40. ENDCG
  41. Subshader
  42. {
  43. Pass
  44. {
  45. ZTest Always Cull Off ZWrite Off
  46. Fog { Mode off }
  47. CGPROGRAM
  48. #pragma vertex vert
  49. #pragma fragment frag
  50. #pragma fragmentoption ARB_precision_hint_fastest
  51. ENDCG
  52. }
  53. }
  54. Fallback off
  55. }