   terrible zfighting
  I implemented realtime shadows on my scene generation engine but it got a terrible zfighing problem between the ambient pass and light passes (http://www.unidev.com.br/imagem/prob.jpg), I see some source codes that implement this kind of shadowing but I did''nt find how those examples dont have zfighting, hehehe. Who knows?(using DirectX 9.0, on zpass/fail shadowing) 
  We used to have similar artifacts. Although it wasn''t me working on the shadows (so I won''t be able to present details), I think it was that we used the FFP for one pass and a VS for another. The difference in precision caused the artifacts.   Muhammad Haggag;  Oh, maybe that''s the problem, cos I''m using vertex shader for light attenuation but for the first pass (ambient light) I used fixed function! ;  FF and programmable pipelines are not guranteed to produce identical results for the same inputs (so not a driver bug, but valid within the spec). Looks like you''ll have to move your ambient pass into a vertex program to make sure they''re the same depth. 