   Z pre-pass problem ... z fightning ?
  I render the scene without lights writting the zbuffer. Then, I render it again with full lights computations. But it happens frequently that some pixels are not written... why ?? I'm sure is kinda a Z precision problem, but how to solve it ?thanks !!   
  Try to reduce your far z distance or increase the near maybe? Whats the format of your depth buffer?  Are you using 16 or 24 bits?   ;  Just a checkbox item: You are using <= as your func for the 2nd pass and not <, correct?   ;  If you're using a vertex shader to do the vertex transformation, make sure you have that same vertex shader (Or at least the same transform math) assigned when you render your first and second pass.If you're using the FFP, you'll get slightly different results from the shader and it'll give you Z-fighting.   ;Quote:Original post by PlayfulPuppyIf you're using a vertex shader to do the vertex transformation, make sure you have that same vertex shader (Or at least the same transform math) assigned when you render your first and second pass.If you're using the FFP, you'll get slightly different results from the shader and it'll give you Z-fighting.Resolved thanks to this advice :)I was using the default shader for the first pass, and a shader of mine for the second, but originally I didn't think it was a problem because the vertex shader was not doing any fancy things with vertexes....... anyway, now it works.Thank you all ;)   