|
97 | 97 |
|
98 | 98 |
|
99 | 99 | #ifdef _IS_ANGELRING_OFF |
100 | | - float2 lightmapUV : TEXCOORD1; |
| 100 | + float2 lightmapUV : TEXCOORD1; |
101 | 101 | #elif _IS_ANGELRING_ON |
102 | 102 | float2 texcoord1 : TEXCOORD1; |
103 | | - float2 lightmapUV : TEXCOORD2; |
| 103 | + float2 lightmapUV : TEXCOORD2; |
104 | 104 | #endif |
105 | | - UNITY_VERTEX_INPUT_INSTANCE_ID |
| 105 | + UNITY_VERTEX_INPUT_INSTANCE_ID |
106 | 106 | }; |
107 | 107 | struct VertexOutput { |
108 | 108 | float4 pos : SV_POSITION; |
|
116 | 116 | //v.2.0.7 |
117 | 117 | float mirrorFlag : TEXCOORD5; |
118 | 118 |
|
119 | | - DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 6); |
| 119 | + DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 6); |
120 | 120 | #if defined(_ADDITIONAL_LIGHTS_VERTEX) || (VERSION_LOWER(12, 0)) |
121 | | - half4 fogFactorAndVertexLight : TEXCOORD7; // x: fogFactor, yzw: vertex light |
| 121 | + half4 fogFactorAndVertexLight : TEXCOORD7; // x: fogFactor, yzw: vertex light |
122 | 122 | #else |
123 | | - half fogFactor : TEXCOORD7; |
| 123 | + half fogFactor : TEXCOORD7; |
124 | 124 | #endif |
125 | 125 |
|
126 | 126 | # ifndef _MAIN_LIGHT_SHADOWS |
127 | | - float4 positionCS : TEXCOORD8; |
| 127 | + float4 positionCS : TEXCOORD8; |
128 | 128 | int mainLightID : TEXCOORD9; |
129 | 129 | # else |
130 | | - float4 shadowCoord : TEXCOORD8; |
131 | | - float4 positionCS : TEXCOORD9; |
| 130 | + float4 shadowCoord : TEXCOORD8; |
| 131 | + float4 positionCS : TEXCOORD9; |
132 | 132 | int mainLightID : TEXCOORD10; |
133 | 133 | # endif |
134 | | - UNITY_VERTEX_INPUT_INSTANCE_ID |
135 | | - UNITY_VERTEX_OUTPUT_STEREO |
| 134 | + UNITY_VERTEX_INPUT_INSTANCE_ID |
| 135 | + UNITY_VERTEX_OUTPUT_STEREO |
136 | 136 |
|
137 | 137 | // |
138 | 138 | #elif _IS_ANGELRING_ON |
|
148 | 148 | #if defined(_ADDITIONAL_LIGHTS_VERTEX) || (VERSION_LOWER(12, 0)) |
149 | 149 | half4 fogFactorAndVertexLight : TEXCOORD8; // x: fogFactor, yzw: vertex light |
150 | 150 | #else |
151 | | - half fogFactor : TEXCOORD8; // x: fogFactor, yzw: vertex light |
| 151 | + half fogFactor : TEXCOORD8; // x: fogFactor, yzw: vertex light |
152 | 152 | #endif |
153 | 153 | # ifndef _MAIN_LIGHT_SHADOWS |
154 | 154 | float4 positionCS : TEXCOORD9; |
|
174 | 174 | float3 direction; |
175 | 175 | float3 color; |
176 | 176 | float distanceAttenuation; |
177 | | - real shadowAttenuation; |
178 | | - int type; |
| 177 | + float shadowAttenuation; |
| 178 | + int type; |
179 | 179 | }; |
180 | 180 |
|
181 | 181 | /////////////////////////////////////////////////////////////////////////////// |
182 | 182 | // Light Abstraction // |
183 | 183 | ///////////////////////////////////////////////////////////////////////////// |
184 | | - real MainLightRealtimeShadowUTS(float4 shadowCoord, float4 positionCS) |
| 184 | + half MainLightRealtimeShadowUTS(float4 shadowCoord, float4 positionCS) |
185 | 185 | { |
186 | 186 | #if !defined(MAIN_LIGHT_CALCULATE_SHADOWS) |
187 | | - return 1.0h; |
| 187 | + return 1.0; |
188 | 188 | #endif |
189 | 189 | ShadowSamplingData shadowSamplingData = GetMainLightShadowSamplingData(); |
190 | 190 | half4 shadowParams = GetMainLightShadowParams(); |
191 | 191 | #if defined(UTS_USE_RAYTRACING_SHADOW) |
192 | 192 | float w = (positionCS.w == 0) ? 0.00001 : positionCS.w; |
193 | | - float4 screenPos = ComputeScreenPos(positionCS/ w); |
| 193 | + float4 screenPos = ComputeScreenPos(positionCS / w); |
194 | 194 | return SAMPLE_TEXTURE2D(_RaytracedHardShadow, sampler_RaytracedHardShadow, screenPos); |
195 | | -#endif |
196 | | - |
| 195 | +#elif defined(_MAIN_LIGHT_SHADOWS_SCREEN) |
| 196 | + return SampleScreenSpaceShadowmap(shadowCoord); |
| 197 | +#endif |
197 | 198 | return SampleShadowmap(TEXTURE2D_ARGS(_MainLightShadowmapTexture, sampler_MainLightShadowmapTexture), shadowCoord, shadowSamplingData, shadowParams, false); |
198 | 199 | } |
199 | 200 |
|
200 | | - real AdditionalLightRealtimeShadowUTS(int lightIndex, float3 positionWS, float4 positionCS) |
| 201 | + half AdditionalLightRealtimeShadowUTS(int lightIndex, float3 positionWS, float4 positionCS) |
201 | 202 | { |
202 | 203 | #if defined(UTS_USE_RAYTRACING_SHADOW) |
203 | 204 | float w = (positionCS.w == 0) ? 0.00001 : positionCS.w; |
|
208 | 209 | #if !defined(ADDITIONAL_LIGHT_CALCULATE_SHADOWS) |
209 | 210 | return 1.0h; |
210 | 211 | #endif |
211 | | - |
| 212 | +# if (SHADER_LIBRARY_VERSION_MAJOR >= 13 && UNITY_VERSION >= 202220 ) |
| 213 | + ShadowSamplingData shadowSamplingData = GetAdditionalLightShadowSamplingData(lightIndex); |
| 214 | +# else |
212 | 215 | ShadowSamplingData shadowSamplingData = GetAdditionalLightShadowSamplingData(); |
| 216 | +# endif |
213 | 217 |
|
214 | 218 | #if USE_STRUCTURED_BUFFER_FOR_LIGHT_DATA |
215 | 219 | lightIndex = _AdditionalShadowsIndices[lightIndex]; |
|
402 | 406 | OUTPUT_LIGHTMAP_UV(v.lightmapUV, unity_LightmapST, o.lightmapUV); |
403 | 407 | OUTPUT_SH(o.normalDir.xyz, o.vertexSH); |
404 | 408 |
|
405 | | -# if defined(_ADDITIONAL_LIGHTS_VERTEX) || (VERSION_LOWER(12, 0)) |
406 | | - o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); |
| 409 | +#if defined(_ADDITIONAL_LIGHTS_VERTEX) || (VERSION_LOWER(12, 0)) |
| 410 | + o.fogFactorAndVertexLight = half4(fogFactor, vertexLight); |
407 | 411 | #else |
408 | | - o.fogFactor = fogFactor; |
| 412 | + o.fogFactor = fogFactor; |
409 | 413 | #endif |
410 | 414 |
|
411 | 415 | o.positionCS = positionCS; |
412 | | - #if defined(_MAIN_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF) |
| 416 | +#if defined(_MAIN_LIGHT_SHADOWS) && !defined(_RECEIVE_SHADOWS_OFF) |
413 | 417 | #if SHADOWS_SCREEN |
414 | 418 | o.shadowCoord = ComputeScreenPos(positionCS); |
415 | 419 | #else |
416 | 420 | o.shadowCoord = TransformWorldToShadowCoord(o.posWorld.xyz); |
417 | 421 | #endif |
418 | 422 | o.mainLightID = DetermineUTS_MainLightIndex(o.posWorld.xyz, o.shadowCoord, positionCS); |
419 | | - #else |
| 423 | +#else |
420 | 424 | o.mainLightID = DetermineUTS_MainLightIndex(o.posWorld.xyz, 0, positionCS); |
421 | | - #endif |
| 425 | +#endif |
422 | 426 |
|
423 | 427 |
|
424 | 428 | return o; |
|
443 | 447 | #else |
444 | 448 | return fragDoubleShadeFeather(i, facing); |
445 | 449 | #endif |
| 450 | + |
446 | 451 | } |
0 commit comments