You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
967 B

5 years ago
  1. Shader "Fog Volume/RT viewers/_ShadowTexture"
  2. {
  3. Properties{
  4. _MainTex("Base", 2D) = "" {}
  5. _Divide("Divide", Range(1, 30000))=1000
  6. }
  7. SubShader
  8. {
  9. Tags { "RenderType"="Opaque" }
  10. LOD 100
  11. Pass
  12. {
  13. CGPROGRAM
  14. #pragma vertex vert
  15. #pragma fragment frag
  16. #include "UnityCG.cginc"
  17. struct appdata
  18. {
  19. float4 vertex : POSITION;
  20. float2 uv : TEXCOORD0;
  21. };
  22. struct v2f
  23. {
  24. float2 uv : TEXCOORD0;
  25. float4 vertex : SV_POSITION;
  26. };
  27. sampler2D _ShadowTexture;
  28. float4 _ShadowTexture_ST;
  29. fixed _Divide;
  30. v2f vert (appdata v)
  31. {
  32. v2f o;
  33. o.vertex = UnityObjectToClipPos(v.vertex);
  34. o.uv = TRANSFORM_TEX(v.uv, _ShadowTexture);
  35. return o;
  36. }
  37. fixed4 frag (v2f i) : SV_Target
  38. {
  39. // sample the texture
  40. //fixed4 col = tex2D(_ShadowTexture, i.uv).r/ _Divide;
  41. fixed4 col = tex2D(_ShadowTexture, i.uv);
  42. col.r = col.r / _Divide;
  43. return col.r*col.g;
  44. }
  45. ENDCG
  46. }
  47. }
  48. }