Why is shadowmap magFilter set to Nearest neighbor?

I was inspecting the standard shadowmap setup, and I noticed that the magnification filter is set to nearest neighbor. Wouldn’t LinearFilter give you smoother shadows? NearestFilter is known for yielding more pixelated texture samples. I’m sure there’s a good explanation for this, but why is it set to Nearest?

Shadow maps store depth so interpolating between pixels actually means your interpolating the depth values stored in each pixel. Turning interpolation on won’t “smooth” shadows the way you’re used to when turning it on for texture maps and may actually introduce new artifacts.

5 Likes

Ah, that explains it! Makes perfect sense, thanks!

2 Likes

Especially when packed in RGBA ^^

2 Likes