|
|
|
|
|
|
float4 _FrustumCorners[4]; |
|
|
|
CBUFFER_END |
|
|
|
|
|
|
|
#if UNITY_REVERSED_Z |
|
|
|
#define BEYOND_SHADOW_FAR(shadowCoord) shadowCoord.z <= UNITY_RAW_FAR_CLIP_VALUE |
|
|
|
#else |
|
|
|
#define BEYOND_SHADOW_FAR(shadowCoord) shadowCoord.z >= UNITY_RAW_FAR_CLIP_VALUE |
|
|
|
#endif |
|
|
|
|
|
|
|
#define OUTSIDE_SHADOW_BOUNDS(shadowCoord) shadowCoord.x <= 0 || shadowCoord.x >= 1 || shadowCoord.y <= 0 || shadowCoord.y >= 1 || BEYOND_SHADOW_FAR(shadowCoord) |
|
|
|
|
|
|
|
half GetShadowStrength() |
|
|
|
{ |
|
|
|
return _ShadowData.x; |
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
// Shadow coords that fall out of the light frustum volume must always return attenuation 1.0 |
|
|
|
// TODO: We can set shadowmap sampler to clamptoborder when we don't have a shadow atlas and avoid xy coord bounds check |
|
|
|
return (shadowCoord.x <= 0 || shadowCoord.x >= 1 || shadowCoord.y <= 0 || shadowCoord.y >= 1 || shadowCoord.z >= 1) ? 1.0 : attenuation; |
|
|
|
return (OUTSIDE_SHADOW_BOUNDS(shadowCoord)) ? 1.0 : attenuation; |
|
|
|
} |
|
|
|
|
|
|
|
inline half ComputeCascadeIndex(float3 positionWS) |
|
|
|