|
|
@@ -179,12 +179,11 @@ float Chebyshev(float2 Moments, float depth)
|
|
|
|
|
|
float GetShadow(float4 shadowPos)
|
|
|
{
|
|
|
- #ifdef D3D11
|
|
|
- shadowPos.xyz /= shadowPos.w;
|
|
|
- #endif
|
|
|
-
|
|
|
#if defined(SIMPLE_SHADOW)
|
|
|
// Take one sample
|
|
|
+ #ifdef D3D11
|
|
|
+ shadowPos.xyz /= shadowPos.w;
|
|
|
+ #endif
|
|
|
float inLight = SampleShadow(ShadowMap, shadowPos).r;
|
|
|
#ifndef SHADOWCMP
|
|
|
return cShadowIntensity.y + cShadowIntensity.x * inLight;
|
|
|
@@ -199,6 +198,9 @@ float GetShadow(float4 shadowPos)
|
|
|
#elif defined(PCF_SHADOW)
|
|
|
// Take four samples and average them
|
|
|
// Note: in case of sampling a point light cube shadow, we optimize out the w divide as it has already been performed
|
|
|
+ #ifdef D3D11
|
|
|
+ shadowPos.xyz /= shadowPos.w;
|
|
|
+ #endif
|
|
|
#if !defined(POINTLIGHT) && !defined(D3D11)
|
|
|
float2 offsets = cShadowMapInvSize * shadowPos.w;
|
|
|
#else
|
|
|
@@ -225,7 +227,7 @@ float GetShadow(float4 shadowPos)
|
|
|
#endif
|
|
|
|
|
|
#elif defined(VSM_SHADOW)
|
|
|
- float2 samples = Sample2D(ShadowMap, shadowPos.xy).rg;
|
|
|
+ float2 samples = Sample2D(ShadowMap, shadowPos.xy / shadowPos.w).rg;
|
|
|
return cShadowIntensity.y + cShadowIntensity.x * Chebyshev(samples, shadowPos.z/shadowPos.w);
|
|
|
#endif
|
|
|
}
|