EnviroApplyShadowsHDRP.shader 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. Shader "Hidden/EnviroApplyShadowsHDRP"
  2. {
  3. Properties
  4. {
  5. //_MainTex ("Texture", any) = "white" {}
  6. //_CloudsTex ("Texture", any) = "white" {}
  7. }
  8. SubShader
  9. {
  10. // No culling or depth
  11. Cull Off ZWrite Off ZTest Always
  12. Pass
  13. {
  14. HLSLPROGRAM
  15. #pragma vertex vert
  16. #pragma fragment frag
  17. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
  18. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  19. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
  20. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FXAA.hlsl"
  21. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/RTUpscale.hlsl"
  22. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/AtmosphericScattering/AtmosphericScattering.hlsl"
  23. #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUtils.hlsl"
  24. struct appdata
  25. {
  26. uint vertexID : SV_VertexID;
  27. float2 uv : TEXCOORD0;
  28. UNITY_VERTEX_INPUT_INSTANCE_ID
  29. };
  30. struct v2f
  31. {
  32. float2 uv : TEXCOORD0;
  33. float4 vertex : SV_POSITION;
  34. UNITY_VERTEX_OUTPUT_STEREO
  35. };
  36. v2f vert (appdata v)
  37. {
  38. v2f o;
  39. UNITY_SETUP_INSTANCE_ID(v);
  40. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  41. o.vertex = GetFullScreenTriangleVertexPosition(v.vertexID);
  42. o.uv = GetFullScreenTriangleTexCoord(v.vertexID);
  43. return o;
  44. }
  45. float _Intensity;
  46. float4 _HandleScales;
  47. TEXTURE2D_X(_MainTex);
  48. TEXTURE2D(_CloudsTex);
  49. float4 frag (v2f i) : SV_Target
  50. {
  51. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
  52. float4 sceneColor = SAMPLE_TEXTURE2D_X_LOD(_MainTex,s_trilinear_clamp_sampler, i.uv, 0);
  53. float cloudShadows = SAMPLE_TEXTURE2D(_CloudsTex,s_trilinear_clamp_sampler, i.uv * _HandleScales.xy).b * _Intensity;
  54. float shadowsClouds = clamp((1-cloudShadows),0,1);
  55. float4 final = float4(sceneColor.rgb * shadowsClouds, sceneColor.a);
  56. return final;
  57. }
  58. ENDHLSL
  59. }
  60. }
  61. }