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.

60 lines
906 B

5 years ago
  1. Shader "Fog Volume/RT viewers/RT_Opacity"
  2. {
  3. Properties{
  4. _MainTex("Base", 2D) = "" {}
  5. RT_Opacity("RT_Opacity", 2D) = "" {}
  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. // make fog work
  17. #include "UnityCG.cginc"
  18. struct appdata
  19. {
  20. float4 vertex : POSITION;
  21. float2 uv : TEXCOORD0;
  22. };
  23. struct v2f
  24. {
  25. float2 uv : TEXCOORD0;
  26. UNITY_FOG_COORDS(1)
  27. float4 vertex : SV_POSITION;
  28. };
  29. sampler2D RT_Opacity;
  30. float4 RT_Opacity_ST;
  31. v2f vert (appdata v)
  32. {
  33. v2f o;
  34. o.vertex = UnityObjectToClipPos(v.vertex);
  35. o.uv = TRANSFORM_TEX(v.uv, RT_Opacity);
  36. return o;
  37. }
  38. fixed4 frag (v2f i) : SV_Target
  39. {
  40. // sample the texture
  41. fixed4 col = tex2D(RT_Opacity, i.uv);
  42. //return col;
  43. return 1-col.r;
  44. }
  45. ENDCG
  46. }
  47. }
  48. }