How to discard the border between 2 cascades

Started by
3 comments, last by MJP 5 years ago

I've tried implement cascaded shadow maps.Every things goes right, except the location between different cascades.There are noticable borders on the screen.I don't quite understand the reason.And I've tried some methed for example blending different cascades or decrease the z value slightly when stenciling the cascade volume(I guess may be the sampling texcoord is beyond shadow map border, so decrease z value can lead to sampling from lower cascade, therefore avoid sample at the higher cascade's border). But these all take no effect.I want to no how this phenomenon is produced.And I found that sample from cubemap for point light shadow can avoid the border, why it works? And how can I fix this problem for CSMs?

Advertisement

Here are screenshots, it may help describe the problem.

csm0.png

csm1.png

got Resolved! I use esm shadow maps, duo to the technique allow using any filtering method including mipmaps,so I use mipmaped shadow maps.I tried using SampleLevel instead of Sample, then the edges disapeared!

Your issue there is that you're sampling different cascades within a 2x2 quad if pixels. Since the UV's between two cascades are unrelated, the pixel shader quad derivatives will end up calculating an incorrect mip level when a quad spans two cascades. The only way to ensure that you select correct mip level is to either manually calculate the mip level and use SampleLevel (which won't work with anisotropic filtering), or you need to manually compute the ddx/ddy gradients and pass them in to SampleGrad.

This topic is closed to new replies.

Advertisement