| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- // Structs
- struct Attributes
- {
- float4 positionOS : POSITION;
- float3 normalOS : NORMAL; // Bending also
- float2 texcoord : TEXCOORD0;
- float2 texcoord1 : TEXCOORD1; // Bending
- half4 color : COLOR; // Bending
- float3 texcoord2 : TEXCOORD2; // Leaves only: Pivot
- UNITY_VERTEX_INPUT_INSTANCE_ID
- };
- struct Varyings
- {
- float2 uv : TEXCOORD0;
- float4 positionCS : SV_POSITION;
- //UNITY_VERTEX_INPUT_INSTANCE_ID
- UNITY_VERTEX_OUTPUT_STEREO
- };
- //--------------------------------------
- // Vertex shader
- #include "Includes/CTI URP Bending.hlsl"
- Varyings DepthOnlyVertex(Attributes input)
- {
- Varyings output = (Varyings)0;
- UNITY_SETUP_INSTANCE_ID(input);
- UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
- CTI_AnimateVertex(
- input,
- #if defined (_BENDINGCOLRSONLY)
- float4(input.color.rg, input.color.ab), // animParams,
- #else
- float4(input.color.rg, input.texcoord1.xy), // animParams,
- #endif
- _BaseWindMultipliers
- );
- output.uv = input.texcoord;
- VertexPositionInputs vertexPosition = GetVertexPositionInputs(input.positionOS.xyz);
- output.positionCS = vertexPosition.positionCS;
- return output;
- }
- //--------------------------------------
- // Fragment shader
- half4 DepthOnlyFragment(Varyings input) : SV_Target
- {
- UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input);
- #if defined(LOD_FADE_CROSSFADE) && !defined(SHADER_API_GLES)
- LODDitheringTransition(input.positionCS.xyz, unity_LODFade.x);
- #endif
- half alpha = SampleAlbedoAlpha(input.uv, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap)).a;
- clip(alpha - _Cutoff);
- return 0;
- }
|