CreaseApply.shader 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "Hidden/CreaseApply" {
  3. Properties {
  4. _MainTex ("Base (RGB)", 2D) = "white" {}
  5. _HrDepthTex ("Base (RGB)", 2D) = "white" {}
  6. _LrDepthTex ("Base (RGB)", 2D) = "white" {}
  7. }
  8. SubShader {
  9. Pass {
  10. ZTest Always Cull Off ZWrite Off
  11. Fog { Mode off }
  12. CGPROGRAM
  13. #pragma fragmentoption ARB_precision_hint_fastest
  14. #pragma vertex vert
  15. #pragma fragment frag
  16. #include "UnityCG.cginc"
  17. sampler2D _MainTex;
  18. sampler2D _HrDepthTex;
  19. sampler2D _LrDepthTex;
  20. uniform float4 _MainTex_TexelSize;
  21. uniform float intensity;
  22. struct v2f {
  23. float4 pos : POSITION;
  24. float2 uv : TEXCOORD0;
  25. };
  26. v2f vert( appdata_img v )
  27. {
  28. v2f o;
  29. o.pos = UnityObjectToClipPos (v.vertex);
  30. o.uv.xy = v.texcoord.xy;
  31. return o;
  32. }
  33. half4 frag (v2f i) : COLOR
  34. {
  35. float4 hrDepth = tex2D(_HrDepthTex, i.uv);
  36. float4 lrDepth = tex2D(_LrDepthTex, i.uv);
  37. hrDepth.a = DecodeFloatRGBA(hrDepth);
  38. lrDepth.a = DecodeFloatRGBA(lrDepth);
  39. float4 color = tex2D(_MainTex, i.uv);
  40. return color * (1.0-abs(hrDepth.a-lrDepth.a)*intensity);
  41. }
  42. ENDCG
  43. }
  44. }
  45. Fallback off
  46. }