Sign in to follow this  


Recommended Posts

Quat    568

I was using a constant shadow bias for shadow acne, but the same constant didn't work well for all angles of the light. So I looked into using SlopeScaledDepthBias to bias the depth value based on the slope with respect to the light when building the shadow map.

Setting SlopeScaledDepthBias = 2.0 seems to fix my problem. However, I do not understand the other two values:

0,//INT DepthBias;
0.0,//FLOAT DepthBiasClamp;

First, why is DepthBias an INT? What if I want to bias a fractional amount? I tried various values for DepthBias and did not notice any changes.

Second, if DepthBiasClamp is set to 0.0, why am I getting any bias at all with SlopeScaledDepthBias?

When the hardware does the biasing, is it done in NDC space?

Share this post

Link to post
Share on other sites
Hodgman    51220
This same question was asked [url=""]back in march[/url], with no responses.

According to [url=""]the MSDN[/url], the units of the integer depth-bias are "the minimum representable value > 0 in the depth-buffer format".
e.g. for a 24-bit integer depth-buffer, a bias of 7 would be equal to 7/(2[sup]^24[/sup])

Share this post

Link to post
Share on other sites
Zoner    232
You will get better results if you ignore depth bias and slope scale depth bias, and come up with another approach. Depth value distribution are non-linear and going down the path of using these settings causes endless tweaking, as in the end they just end up adding some linear offset into what is an exponential distribution of values.

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

Sign in to follow this