Jump to content
  • Advertisement
Sign in to follow this  
Sytto

Exponential VSM problem

This topic is 494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys :) I´m having real troubles implementing Exponential VSM and I need someone to tell me whether this is a bug or an expected behaviour.

In my scene, I have several shadow casters and a terrain that doesn´t cast shadows.

For creating the VSM, i do the following thing:

First, i do a depth prepass without any color outputs, from lights point of view.
Secondly, i transform the depth to the exponential VSM format in a separate fullscreen pass, outputting R=WarpedDepth, G=WarpedDepth*WarpedDepth. (my implementation is exactly the same as in MJP´s great article :)
Next, i apply a separable gaussian blur to the VSM shadow map.
Lastly, i apply the shadow and lighting to my scene.

Everything works fine, as long as the shadows are casted to other shadow casters, it looks smooth and great. But when the shadows are casted on the terrain (or any object which is not in the shadowmap) the VSM seems to work pretty bad, is this an expected behaviour ?.

Here are some pics that show the problem:

 

 598dfd1dd6110_ABABEBFE639192CF5ECF0E42A2E9EAFD7A595A3127FB226267pimgpsh_fullsize_distr.png.80f587f48a84c27dc4a6499a7a5a70b3.png 

 

Left small cube = smooth shadow, since the shadow is being casted on the bigger cube
Right small cube = horrible shadow, in this case, having a big gaussian blur kernel even makes the problem worse (it makes the shadow smaller, but not smoother!). 

Here is another pic with more detail.

 

598dfe0f358b5_981EB1572D8BE1F72434C6DE9AA9E96E2C4E0EBDF966278667pimgpsh_fullsize_distr.png.2dabb854a8cd90eae5ead708916d080a.png

Notice how the rooftops have super nice and smooth shadows, but the terrain (roads, etc) and basically every shadow casted on an object that doesn´t cast shadows is ugly. In the pics i made the shadowmap resolution smaller to better show the problem. But the problem is also noticeable using a 2048x2048 shadowmap 

 

Am i doing something terribly wrong or this expected behaviour ? :) 

Any help is appreciated, many thanks! 

Share this post


Link to post
Share on other sites
Advertisement
9 minutes ago, LandonJerre said:

It is an expected behaviour, with VSM (and any other related techniques) you have to render both the occluders and the receivers into the shadow map. If you think about it, when you blur the VSM without the receivers in it (or even if you just sample that map with proper texture filtering), you blur between the occluder depths, and the maximum z value, meaning that the blurred values will strongly tend towards the max z. Tending towards max z also means that the blurred values will be "behind" the receiver pretty quickly, and that messes up the whole thing. (This explanation is exactly mathematically precise, but hopefully it's enough to illustrate the problem.)

Thank you very much for your answer, it really makes sense to me :). Im thinking how to "fix" this, maybe adding a proxy geometry (like a plane) under the terrain could fix this issue. If anyone has a better idea i´d be glad to read it :) 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!