|
|
|
|
|
|
half attenuation = SAMPLE_TEXTURE2D(_ScreenSpaceShadowMap, sampler_ScreenSpaceShadowMap, shadowCoord.xy).x; |
|
|
|
#endif |
|
|
|
|
|
|
|
// Apply shadow strength |
|
|
|
return LerpWhiteTo(attenuation, GetShadowStrength()); |
|
|
|
return attenuation; |
|
|
|
} |
|
|
|
|
|
|
|
inline real SampleShadowmap(float4 shadowCoord) |
|
|
|
|
|
|
attenuation = SAMPLE_TEXTURE2D_SHADOW(_ShadowMap, sampler_ShadowMap, shadowCoord.xyz); |
|
|
|
#endif |
|
|
|
|
|
|
|
#if SHADER_HINT_NICE_QUALITY |
|
|
|
// Apply shadow strength |
|
|
|
attenuation = LerpWhiteTo(attenuation, GetShadowStrength()); |
|
|
|
#endif |
|
|
|
|
|
|
|
// Shadow coords that fall out of the light frustum volume must always return attenuation 1.0 |
|
|
|
return (OUTSIDE_SHADOW_BOUNDS(shadowCoord)) ? 1.0 : attenuation; |
|
|
|
} |
|
|
|
|
|
|
half RealtimeShadowAttenuation(float4 shadowCoord) |
|
|
|
{ |
|
|
|
#if NO_SHADOWS |
|
|
|
return 1.0h; |
|
|
|
return 1.0h; |
|
|
|
#elif SHADOWS_SCREEN |
|
|
|
return SampleScreenSpaceShadowMap(shadowCoord); |
|
|
|
#else |
|
|
|