Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Deferred Shadows and precision


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
2 replies to this topic

#1 mauro78   Members   -  Reputation: 141

Like
0Likes
Like

Posted 04 May 2012 - 03:22 PM

Hi All!

I'm trying to reuse the g-buffer for computing a "shadows mask or buffer"; basically after computing the appropriate Shadows Map for a light (point,directional or spot) I just want to reuse g-buffer stored position for performing shadows check for shadows receiving geometry.

Now comes a little problem: If I just store world or view space position (viewpos.x,viewpos.y,viewpos.z) in the g-buffer everything is fine Posted Image

If I try to store just view space lenght and reconstruct position (just to save memory bandwidth), on shadows check I just got some artifacts almoust just on "caster" geometry and when the camera comes close to them (look at red circle):

Posted Image


in that case depth is stored like this:

float depth = length(ViewPos);

and reconstructed like this:


float3 ER = float3(vScreenCoord.x*gScreenRatio,vScreenCoord.y,1/(tan(gHalfFOV)));
float4 posView = float4(( normalize(ER) * g_buffer_depth),1.0f);


To solve the problem I've raise SHADOWS_EPSILON (or BIAS) value but this lead to other problems...so I'm wondering if someone can point me out where the problem can be.....it's just a numerical imprecision problem?

Any advice appreciated Posted Image

Thanks Mauro


p.s.
I've been using this reconstruction for deferred lighting in the past months without noticeable artifacts....but probably Shadows artifacts are more sensitive to numerical errors

Edited by mauro78, 04 May 2012 - 03:29 PM.


Sponsor:

#2 mauro78   Members   -  Reputation: 141

Like
1Likes
Like

Posted 05 May 2012 - 01:28 AM

UPDATE: If I save on the g-buffer (better on a 32 bit target channel ) the projection space depth and then later reconstruct from projection space 2 world space I got some really nice results without any visible artifacts.

So now I'm guessing that storing the view space depth and reconstruct using trigonometric tan(half_FOV) function introduce some imprecision and possibly some instability.......at least when I perform some shadows test.


Posted Image

Edited by mauro78, 05 May 2012 - 01:38 AM.


#3 skytiger   Members   -  Reputation: 202

Like
0Likes
Like

Posted 13 May 2012 - 10:14 AM

in depth discussion:
http://mynameismjp.wordpress.com/2010/09/05/position-from-depth-3/

my way:
http://skytiger.wordpress.com/2012/03/17/deferred-shading-with-reflections/




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