Yet another problem with shadow volume rendering

Hello!
I have a new problem when i draw the shadow volumes. I get some artifacts. Here is a screenshot:

http://bekengine.periergoi.gr/Screenshots/shadow_volume_prob.JPG

and here is my source:
http://rafb.net/paste/results/7JGlti54.html

any idea what is going on?

thanks in advance.

This looks like zbuffer variations on your illumination pass.

some things to try:

  1. Enable texturing during the zbuffer fill pass, this will keep the paths similar and may produce the same depth value for the generated fragments. Try enabling blending too.

  2. Use glPolygonOffset to apply depth separation between passes.

  3. if using shaders use z invariance.

You shouldn’t need all of these and 1 would be the least attractive option but the easiest solution. Your software should work on some hardware without any modifications.

the stragne think is that in an other older version of my engine a do exactly the same stuff (but i have different pixel shaders) and it works perfectly! why is that?

what nay cause this problem?

thanks

Vertex shaders doesn’t generate the same position data as fixed function, unless the position-invariant option is used.

  • GLSL: ftransform();
  • ARB_vertex_program: OPTION ARB_position_invariant

Also, make sure that you draw the shadow volume and the “world” with the same primitives (triangles, strips).

hey. I use this command in the ARB_vertex_program.
now the artifacts is less than before. but they still exist. If i try to render the depth pass using a vertex program? is it gonna work? i will try it. But thanks for making my understand what causes the problem!

oh… finaly didnt need to use a simple vertex program…
the draw depth has rendering using glBegin(GL_POLYGON)

I make it glBegin(GL_TRIANGE STRIP) and everything is ok.
thanks guys!!!

Can I ask why “Vertex shaders doesn’t generate the same position data as fixed function, unless the position-invariant option is used”?