How to reduce noise on PCSS shadows

Hello, I’m trying to use PCSS shadows for my project but there’s too much noise generated with the current implementation. Is there a way to reduce it either in the editor or the source code?



You would need to increase number of samples taken for both blocker search and shadow filtering.
It can be done in defines of ShadowPercentageCloserFiltering.ush

Hi Deathrey, I tried increasing the samples up to 15 (as crazy as that is), it tanked my fps to 2 and the noise was still there (although marginally reduced). Is this the only way to reduce it?

What kind of noise exactly are we talking about? Can you post a gif or something like that?

Not sure if its artifacting or noise, but its definitely there.

Yeah, PCSS implementation is still experimental in UE4, so I think improvements will be implemented at some point.

I haven’t looked in-depth at PCSS in UE4, but I can tell you that in regards to shadow filtering, you always have to choose between either banding artifacts or noise, depending on the sampling pattern.

The biggest problem for you right now, is that noise changes each frame, even when the camera is stationary. If you ask me, I think that it is only acceptable, when camera is in motion.

Usually penumbra sizes are quite small and temporal aa does amazing job at getting rid of the noise, but in your case, perhaps, modifying PCSS code, to use a different sampling pattern is what you need to make the noise less apparent and frame to frame coherent.

Going from sobol random to a much simpler fixed disc is probably worth trying.

Alright I’ll try doing that, thanks for all the help BTW, there isn’t any documentation for this stuff online so I assumed only engine developers to know about it. I assume you aren’t getting any noise in your projects when using PCSS? If that’s the case are you using dynamic lighting at all or could this be simply related to certain project settings that I have enabled/disabled?

There is no documentation about specific implementation in UE4, and it is unlikely that there should be one, but PCSS itself is well documented and there are quite a few papers, including specific implementation examples with shader code existing on the web.

The noise is definitely not project specific, but under certain conditions, it is more noticeable than desired.

Don’t be afraid to experiment a bit. For example, you can remove frame index for SobolRandom, replacing it with constant integer. Settings PCSS_SHARE_PER_PIXEL_QUAD to 0 should also help.