   shadow bias problem
  hi guys,i've just finished my shadow engine for spot light but encounters serious bias problemi'm working on DX9 and use the slope and depth bias render state to wipe bias artefacts but when a bias value seems to work perfectly, it becomes very bad when i move the lightany ideas ?thanks   
  Variance Shadow Maps (see the other thread in this forum) don't suffer from this problem. How to answer your question, I dont't know. I searched ages for an algorithm to calculate the correct bias, but have never found anything.Since I use VSM, the problem is gone. But I'm still interested in a solution.   ;  ok i had justly anticipated to test variance shadow map !is that difficult to convert my classic shadow map implementation ?is there a more easier to understand sample code somewhere ?thanks   ;  it's very easy to adapt your default shadow mapping implementation. You just have to give 2 extra parameters from your application to the scene when creating the shadow (the position and radius of your light). And instead of storing the depth of your object, you store the mean and mean difference (see sample). Then while sampling your shadow map in a shader to calculate the shadow contribution, you replace the code by the VSM code. You have more than enough with only the FX composer project.Good luck,KenzoPS: With VSM you will again run into parameter tweaking, with shadow epsilon and offset, to reduce the light bleeding effect.   ;  that seems pretty easyi will try to adapt the shadow map DX9 sample to use variance SM as nobody already does it !   ;Quote:Original post by GuoshimaPS: With VSM you will again run into parameter tweaking, with shadow epsilon and offset, to reduce the light bleeding effect.Just to note we have a good idea of a simple way to eliminate the numeric epsilon value and increase the quality of the shadow edges slightly as well... more on this later :);  great !!for the moment i try to adapt the shadow map DX9 sample but don't understand your depth VSM pixel shader from your VSM demo :what is the distribute factor variable ?and what does the join function ?    if (distribute_outputs) { // Rescale and distribute precision to four components output(2,3) = frac(moments * distribute_factor); output(0,1) = moments - (output(2,3) / distribute_factor);    } else { output = join(moments(0,1), ShConstAttrib2f(0, 0));    }thanks !   ;Quote:Original post by Guoshimait's very easy to adapt your default shadow mapping implementation. You just have to give 2 extra parameters from your application to the scene when creating the shadow (the position and radius of your light). And instead of storing the depth of your object, you store the mean and mean difference (see sample). Then while sampling your shadow map in a shader to calculate the shadow contribution, you replace the code by the VSM code. You have more than enough with only the FX composer project.where is this FX composer project ??i only have the VSM demo from the official site   ;Quote:Original post by zoretwhat is the distribute factor variable ?That's just a trick to harvest a few extra bits of precision out of the extra two components in the shadow map texture. Feel free to ignore it (i.e. use the non-distribute-outputs control branch). For more info, check out the GDC slides.Quote:Original post by zoretand what does the join function?It merely "joins" two tuples together. Same as something like float4(var1, var2) in HLSL.;  and do you know where is the FX composer project ??thanks !   