Brak opisu
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.

DepthOnlyPass.hlsl 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #if defined(LOD_FADE_CROSSFADE)
  5. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/LODCrossFade.hlsl"
  6. #endif
  7. struct Attributes
  8. {
  9. float4 position : POSITION;
  10. float2 texcoord : TEXCOORD0;
  11. UNITY_VERTEX_INPUT_INSTANCE_ID
  12. };
  13. struct Varyings
  14. {
  15. #if defined(_ALPHATEST_ON)
  16. float2 uv : TEXCOORD0;
  17. #endif
  18. float4 positionCS : SV_POSITION;
  19. UNITY_VERTEX_INPUT_INSTANCE_ID
  20. UNITY_VERTEX_OUTPUT_STEREO
  21. };
  22. Varyings DepthOnlyVertex(Attributes input)
  23. {
  24. Varyings output = (Varyings)0;
  25. UNITY_SETUP_INSTANCE_ID(input);
  26. UNITY_TRANSFER_INSTANCE_ID(input, output);
  27. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  28. #if defined(_ALPHATEST_ON)
  29. output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);
  30. #endif
  31. output.positionCS = TransformObjectToHClip(input.position.xyz);
  32. return output;
  33. }
  34. half DepthOnlyFragment(Varyings input) : SV_TARGET
  35. {
  36. UNITY_SETUP_INSTANCE_ID(input);
  37. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  38. #if defined(_ALPHATEST_ON)
  39. Alpha(SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)).a, _BaseColor, _Cutoff);
  40. #endif
  41. #if defined(LOD_FADE_CROSSFADE)
  42. LODFadeCrossFade(input.positionCS);
  43. #endif
  44. return input.positionCS.z;
  45. }
  46. #endif