I have implemented shadow volumes, and I do a render pass for ambient light with glDepthFunc(GL_LESS) and then for each light I do an additional pass with glDepthFunc(GL_EQUAL) and blending enabled(if of course it passes the stencil test for this light).
The objects during the ambient pass are rendered through the fixed pipeline (just their textures multiplied with 0.1). The later render passes though, for some object use ARB_vertex_program for bump map puproses.
The problem is that for the objects that are rendered using vertex programs there is a lot of z-fighting during the blending (indepedently of whether they are shadowed or not). This does not happen for those objects that are rendered using fixed pipeline both at the ambient pass and the specular passes.
As far as I know I couldnot find any bug in my code. My guess is that the transformation is done with different percision in the vertex program compared to the fixed pipeline. I have a GeForce 4 GO so the fixed pipeline is done in the GPU (T&L) and the vertex programs probably in the CPU. Has anyone encountered such problems? Any advice on how to solve it?
PS1: in the vertex program I do the usual stuff with the vertex position and do not mess with it in any other way:
DP4 result.position.x, mvp, pos ;
DP4 result.position.y, mvp, pos ;
DP4 result.position.z, mvp, pos ;
DP4 result.position.w, mvp, pos ;
PS2: Of course I know that a solution would be to write a VP that emulates the fixed pipeline and use this one to do the ambient pass for those objects that will later be rendered using VP but I was hoping for something simpler.