@@ -20,11 +20,8 @@ struct VertexOutput
2020 float2 uv : TEXCOORD0 ;
2121 float3 normal : NORMAL ;
2222 float3 dynamicWorldPos: TEXCOORD3 ;//world position moved by wind and other things
23- float3 staticWorldPos: TEXCOORD4 ;//static world position for sampling a texture
24- float3 scale: TEXCOORD5 ;
2523 float distToCam: TEXCOORD6 ;
2624 float textureNoise: TEXCOORD7 ;
27- uint lodIndex : TEXCOORD8 ;
2825};
2926
3027//individuall buffers per material
@@ -93,7 +90,7 @@ void Applyfog(inout float4 color, float3 positionWS)
9390#endif
9491}
9592
96- void ApplyTexColor (float3 worldPos, float2 uv, float textureNoise, out float4 texCol) {
93+ void ApplyTexColor (float2 uv, float textureNoise, out float4 texCol) {
9794 uv = uv * agr_billboardTextures_ST.xy + agr_billboardTextures_ST.zw;
9895 float index = floor (textureNoise * (agr_billboardTextureCount));
9996 texCol = SAMPLE_TEXTURE2D_ARRAY (agr_billboardTextures, sampler_agr_billboardTextures, uv, index);
@@ -106,7 +103,6 @@ VertexOutput vert (VertexInput input, uint instanceID : SV_InstanceID)
106103
107104 uint index = instanceData.trsIndex;
108105 uint lodIndex = instanceData.lodIndex;
109- output.lodIndex = lodIndex;
110106
111107#ifdef SHADOW_CASTER_PASS
112108 if (lodIndex > 0 )
@@ -127,7 +123,6 @@ VertexOutput vert (VertexInput input, uint instanceID : SV_InstanceID)
127123
128124 //applying transformation matrix
129125 float3 staticWorldPos = mul (mat, float4 (vertex.xyz, 1 ));
130- output.staticWorldPos = staticWorldPos;
131126
132127 float3 camPos = _WorldSpaceCameraPos;
133128 output.distToCam = distance (staticWorldPos, camPos);
@@ -144,7 +139,6 @@ VertexOutput vert (VertexInput input, uint instanceID : SV_InstanceID)
144139 noise = (noise - .5 ) * 2 .;
145140 scale = GetScaleFromMatrix (mat);
146141 }
147- output.scale = scale;
148142
149143
150144 //to keep bottom part of mesh at its position
@@ -159,12 +153,12 @@ VertexOutput vert (VertexInput input, uint instanceID : SV_InstanceID)
159153 //distortion based on view
160154 float3 viewDisplacement = mul (UNITY_MATRIX_VP, input.normal) * dynamicWorldPos.z;
161155 dynamicWorldPos.xz += ((1 . - viewDisplacement) * 0.0001 ) * output.uv.y;
162- output.dynamicWorldPos = dynamicWorldPos;
156+ output.dynamicWorldPos = dynamicWorldPos;
163157
164158 output.vertex = mul (UNITY_MATRIX_VP, float4 (dynamicWorldPos, 1 ));
165159
166160 //generating texture noise in vertex stage to improve performance
167- output.textureNoise = GetGrassNoise (output. staticWorldPos);
161+ output.textureNoise = GetGrassNoise (staticWorldPos);
168162
169163 output.normal = (agr_flatShading < 0 ) ? input.normal : 0 ;
170164 return output;
@@ -179,7 +173,7 @@ float4 frag (VertexOutput input) : SV_Target
179173 float4 texCol = 0 ;
180174 float noise = input.textureNoise;
181175
182- ApplyTexColor (input.staticWorldPos, input. uv, noise, texCol);
176+ ApplyTexColor (input.uv, noise, texCol);
183177
184178 texCol.a *= (1 . - fade);
185179 if (texCol.a < agr_alphaCutoff) {
0 commit comments