Jump to content
  • Advertisement
frostbyte0085

3D Matching filtered EVSM to PCF

Recommended Posts

Posted (edited)

Hello,

I have been exploring the possibility of switching from using PCF to either VSM or EVSM for my shadow maps. I have it all working at the moment, however I am running into difficulty matching the EVSM shadows' penumbras to the PCF ones. Small details are lost (while usually preserved during PCF) to the point where to get a soft penumbra, I either need to apply lots of blur (and lose all detail), or stick to a harder penumbra (which at that point, I may as well use PCF).

I've tried a box and gaussian blurs of various kernel sizes. I wonder what people thoughts are on this?

Edit: I've also tried a mixture of a small shadow map blur and then a 5-tap average when sampling the filtered map, but this defeats the purpose of pre-filtering I suppose. Results were a little bit better though.

Thank you

 

Edited by Alkis Lekakis

Share this post


Link to post
Share on other sites
Advertisement

Well it really depends on how exactly you're implemented your EVSM and your PCF. In general you should be able to use the same exact code that you use for PCF to sample your EVSM map (with point filtering, no mipmaps, no MSAA, etc,) and you should get very similar results in terms of your filtering. If you try that and things don't match up, then your probably have a bug or inconsistency elsewhere.

Could you provide some more details on what you're doing for your PCF and EVSM paths?

Share this post


Link to post
Share on other sites

Hi Matt,

So for the EVSM I do the following during filter pass:

  • Horizontal compute blur:
    Read from source shadowmap and convert to EVSM. Blur the converted results.
  • Vertical compute blur:
    Read the horizontally blurred EVSM map and blur vertically.

Sampling from the source textures is always done with a point sampler.

And for the shadow test, I use a standard negative & positive exponent Chebyshev function (like you have in your sample). The difference is that I use a bilinear sampler, I will try point later. No mipmaps, no MSAA yet. I've tried several approached to blurring the shadowmaps and they all yield the same result, so I suspect there is an issue in my shadow testing code. The blurred result seems to be correct in PIX.

For PCF, I have both traditional 5-tap PCF and also poisson disc filtering. None of those match the EVSM (and the PCF / Poisson ones are "correct").

Share this post


Link to post
Share on other sites

So a quick update on my problem, it does seem to be a problem with the testing function.

Judging from the results, the depth range of the occludee and the occluder seem different (although they should be the same, they both in z/w format, [0, 1] range). This would explain for example also why the further away the occludee is from the occluder, the more blocky and unfiltered the result seems (within the same cascade).

 

Share this post


Link to post
Share on other sites

Okay, so this is now fixed... I was ignoring the fact that we use reversed depth in our engine (moving to a new huge project without knowing what's going on in it exactly is definitely not helping).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!