Horde3D http://horde3d.org/forums/ |
|
Shadow Bias http://horde3d.org/forums/viewtopic.php?f=1&t=524 |
Page 1 of 1 |
Author: | PuG [ 06.10.2008, 08:39 ] |
Post subject: | Shadow Bias |
Good morning. Quick question on the shadow bias settings, with a large scenes im finding it virtually impossible to have a shadow bias suitable for all items based from one global value. Would it not be better (if its possible) to have it defined on a per object bases rather than per light? |
Author: | marciano [ 06.10.2008, 10:13 ] |
Post subject: | Re: Shadow Bias |
Good question. I never saw the bias on a per-object basis. The bias depends among other factors on the curvature of the surface, the size of the projected texels and also the radius of the light source (depth range). So I think it is not possible to find a global per-object bias that would work with all lights. But what I have been thinking about is having a different bias for each shadow map split (for the cascaded SMs). We had the same problem as you back in the University days with our huge city scene. We found a solution that clearly reduces the biasing problem but requires ShaderModel 3 hardware. It is just a single line; it is already in the shaders but commented out. Look at the SHADOWMAP contexts. Code: // Clearly better bias but requires SM 3.0 gl_FragDepth = dist + abs( dFdx( dist ) ) + abs( dFdy( dist ) ) + shadowBias; In case you wonder about the dFdx/dFdy functions: They describe the rate of change of a value relative to the neighboring pixels. So this method better takes into account the curvature of surfaces. |
Author: | swiftcoder [ 06.10.2008, 16:48 ] |
Post subject: | Re: Shadow Bias |
marciano wrote: Code: // Clearly better bias but requires SM 3.0 In case you wonder about the dFdx/dFdy functions: They describe the rate of change of a value relative to the neighboring pixels. So this method better takes into account the curvature of surfaces.gl_FragDepth = dist + abs( dFdx( dist ) ) + abs( dFdy( dist ) ) + shadowBias; |
Author: | PuG [ 06.10.2008, 17:09 ] |
Post subject: | Re: Shadow Bias |
Thanks for the replies. I will give it ago and see what happens, running a Geforce 8800GT. I know Tor. Advanced Engine does lighting based on a per object bias, but that's probably a completely different system from Horde's. Its an interesting problem. |
Page 1 of 1 | All times are UTC + 1 hour |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |