DepthOnlyPass.hlsl 1017 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef UNIVERSAL_DEPTH_ONLY_PASS_INCLUDED
  2. #define UNIVERSAL_DEPTH_ONLY_PASS_INCLUDED
  3. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  4. struct Attributes
  5. {
  6. float4 position : POSITION;
  7. float2 texcoord : TEXCOORD0;
  8. UNITY_VERTEX_INPUT_INSTANCE_ID
  9. };
  10. struct Varyings
  11. {
  12. float2 uv : TEXCOORD0;
  13. float4 positionCS : SV_POSITION;
  14. UNITY_VERTEX_INPUT_INSTANCE_ID
  15. UNITY_VERTEX_OUTPUT_STEREO
  16. };
  17. Varyings DepthOnlyVertex(Attributes input)
  18. {
  19. Varyings output = (Varyings)0;
  20. UNITY_SETUP_INSTANCE_ID(input);
  21. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  22. output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
  23. output.positionCS = TransformObjectToHClip(input.position.xyz);
  24. return output;
  25. }
  26. half4 DepthOnlyFragment(Varyings input) : SV_TARGET
  27. {
  28. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  29. Alpha(SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)).a, _BaseColor, _Cutoff);
  30. return 0;
  31. }
  32. #endif