Jump to content

  • Log In with Google      Sign In   
  • Create Account


EVSM artifacts at depth discontinuities in the gbuffer


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 DrColossus   Members   -  Reputation: 456

Like
0Likes
Like

Posted 20 May 2012 - 04:33 AM

I just implemented EVSMs yesterday, but i get some artifacts at depth discontinuities in my gbuffer and im unsure what's causing them.

Some images of how it looks (click to enlarge):

Posted Image

the shadow term by itself:

Posted Image

comparison:

Posted Image


I don't get those artifacts with simple PCF filtering or any of my lighting.

For the EVSM i'm currently rendering linear depth into a single 32bit float multisample texture, using a custom resolve to calculate the moments and store them into another GL_RGBA32F texture. The resolved EVSM then gets blurred using a seperable box filter in two passes.

the lighting shader: http://pastebin.com/JReUh3e3

There is also a simple tonemapping and gamma correction shader applied after lighting.

[edit] Oh and sometimes (very rare) i get these weird blocky artifacts:

Posted Image


Any ideas on what's causing that and how to get rid of it?

Edited by DrColossus, 20 May 2012 - 04:58 AM.


Sponsor:

#2 DrColossus   Members   -  Reputation: 456

Like
0Likes
Like

Posted 20 May 2012 - 12:17 PM

I think i just figured it out, the pixel-sized artifacts are caused by mipmapping. I disabled it and they're gone now.
And the blocky artifacts might be precision issues due to the high exponent i'm using. They only occur sparingly near the lightsource

Edited by DrColossus, 20 May 2012 - 12:17 PM.


#3 MJP   Moderators   -  Reputation: 10111

Like
1Likes
Like

Posted 20 May 2012 - 03:42 PM

Mipmaps are automatically selected based on the derivatives of the texture coordinates you use to sample the texture. This causes problems in a deferred rendering scenario, since you get incorrect derivatives at discontinuities in the depth buffer for texture lookups that are based on a depth value. Shadow map lookups fall under this categeory, as do projected gobo textures for spot lights. The simple solution is to manually calculate a mip level yourself based on the depth value itself. Or you can store the derivatives of the depth buffer in your G-Buffer, and use that to compute the mip level. Either way you may not want to just disable mip maps for your shadow map, since being able to use mip maps is one of the key advantages of VSM techniques.

Edited by MJP, 21 May 2012 - 12:00 PM.


#4 DrColossus   Members   -  Reputation: 456

Like
0Likes
Like

Posted 21 May 2012 - 10:59 AM

Thank you very much for the explanation, that clears things up quite a bit.

Is there a better way to calculate the derivatives than sampling four adjacent depth values as in Humus' Volume Roads sample? http://www.humus.name/index.php?page=3D&ID=84

I guess i'll do that once i implement MSAA and some form of edge detection to only calculate the derivatives where they're needed.

#5 MJP   Moderators   -  Reputation: 10111

Like
1Likes
Like

Posted 21 May 2012 - 12:06 PM

In the past I've done something like this for decal projection:

float lod = max(textureSize.x, textureSize.y) * length(eyePos - surfacePos);
lod /= (lerp(displaySize.x, displaySize.y, 0.5f) * saturate(dot(normalize(eyePos - surfacePos), normal)));
lod = max(log2(lod), 0.0f);

I think I based it on something from a DICE presentation...I can't quite remember.

EDIT: it was from "Destruction Masking in Frostbite 2"

Edited by MJP, 21 May 2012 - 12:07 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS