CTI URP Bark DepthOnly Pass.hlsl 1.5 KB

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