Shadow Map
Shadow mapping is a widely used technique in real-time rendering to produce realistic shadows. The process involves placing a camera at the light's position and rendering the scene from the light's perspective before the main rendering pass. This pre-rendered depth information, stored in a depth buffer, is called the shadow map.

A shadow map
Percentage-Closer Filtering (PCF)
When sampling the shadow map using projected texture coordinates, it’s common for the sampling point to fall between four texels, rather than directly on one texel...

Shadow Effect without PCF

Shadow Effect with PCF
float CalcShadowFactor(SamplerComparisonState samShadow, Texture2D shadowMap, float4 shadowPosH)
{
shadowPosH.xyz /= shadowPosH.w;
float depth = shadowPosH.z;
float percentLit = 0.0f;
[unroll]
for (int i = 0; i < 9; ++i)
{
percentLit += shadowMap.SampleCmpLevelZero(samShadow,
shadowPosH.xy, depth, int2(i % 3 - 1, i / 3 - 1)).r;
}
return percentLit /= 9.0f;
}
Challenges and Cascaded Shadow Maps (CSMs)
Undersampling and oversampling are common issues in shadow mapping...

Scene from player camera

CSM Level 1

CSM Level 2