CTI URP Leaves DepthOnly Pass.hlsl 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Structs
  2. struct Attributes
  3. {
  4. float4 positionOS : POSITION;
  5. float3 normalOS : NORMAL; // Bending also
  6. float2 texcoord : TEXCOORD0;
  7. float2 texcoord1 : TEXCOORD1; // Bending
  8. half4 color : COLOR; // Bending
  9. float3 texcoord2 : TEXCOORD2; // Leaves only: Pivot
  10. UNITY_VERTEX_INPUT_INSTANCE_ID
  11. };
  12. struct Varyings
  13. {
  14. float2 uv : TEXCOORD0;
  15. float4 positionCS : SV_POSITION;
  16. //UNITY_VERTEX_INPUT_INSTANCE_ID
  17. UNITY_VERTEX_OUTPUT_STEREO
  18. };
  19. //--------------------------------------
  20. // Vertex shader
  21. #include "Includes/CTI URP Bending.hlsl"
  22. Varyings DepthOnlyVertex(Attributes input)
  23. {
  24. Varyings output = (Varyings)0;
  25. UNITY_SETUP_INSTANCE_ID(input);
  26. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
  27. CTI_AnimateVertex(
  28. input,
  29. #if defined (_BENDINGCOLRSONLY)
  30. float4(input.color.rg, input.color.ab), // animParams,
  31. #else
  32. float4(input.color.rg, input.texcoord1.xy), // animParams,
  33. #endif
  34. _BaseWindMultipliers
  35. );
  36. output.uv = input.texcoord;
  37. VertexPositionInputs vertexPosition = GetVertexPositionInputs(input.positionOS.xyz);
  38. output.positionCS = vertexPosition.positionCS;
  39. return output;
  40. }
  41. //--------------------------------------
  42. // Fragment shader
  43. half4 DepthOnlyFragment(Varyings input) : SV_Target
  44. {
  45. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
  46. #if defined(LOD_FADE_CROSSFADE) && !defined(SHADER_API_GLES)
  47. LODDitheringTransition(input.positionCS.xyz, unity_LODFade.x);
  48. #endif
  49. half alpha = SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)).a;
  50. clip(alpha - _Cutoff);
  51. return 0;
  52. }