PDA

View Full Version : Lines "vibrations", Shadow Volume cracks



Dtag
12-07-2003, 12:34 AM
Hi
Ive got a strange problem with my shadowvolumes:
Small cracks appear in the volume, depending on my position/where I look at. ( This can not be solved with glPolygonOffset, Ive been playing around with all kinds of values. ).
If I render the volume in wireframe, I can see that the lines that intersect the surface, on which the shadow is supposed to be visible, move slightly around as I change my position.
At first I guessed this is caused by the extrusion ( setting w=0 ), but then I just rendered a normal line with 2 vectors that have w=1 and I can still see the line move when I get really close.
Tough being able to see the lines moving can only be seen at a very low distance to the line, the cracks in the volume are visible across a high distance and it simply looks ugly http://www.opengl.org/discussion_boards/ubb/frown.gif

I started thinking about the projection matrix, but since the effect occurs with both, my infinite frustum and gluLookAt, I dont really think that this can be the problem.
Any ideas?

Dtag
12-07-2003, 06:28 AM
Its gluPerspective, not gluLookAt http://www.opengl.org/discussion_boards/ubb/smile.gif

Tom78
12-07-2003, 07:27 AM
Try to use the inverse of your object (The backfaces) to extrude the volume. This worked very well for me and i had the same problem before.

cu
Tom

Dtag
12-07-2003, 07:54 AM
Hmmmm it looks a little different now, but the basic problem still exists ;(

V-man
12-07-2003, 10:26 AM
You see cracks like you do for T-junctions?

Try extruding by a fixed amount instead of infinity.

Dtag
12-07-2003, 11:17 AM
Ive tried extruding by a fixed amount - it doesnt really change alot. Ive heard of the problem with the t junctions. It could be a reason but i think i can exclude them. The problem Iam actually having is that the volume seems to move slightly when I turn... and this is not the whole volume but only single tris of it, independently from the others. And I guess this is not the effect one would expect with the t junctions, because t junctions means missing edges -> incomplete volume...., but nothing about cracks etc... right?

[This message has been edited by Dtag (edited 12-07-2003).]

ZbuffeR
12-08-2003, 01:49 AM
Originally posted by Dtag:
The problem Iam actually having is that the volume seems to move slightly when I turn...
Just a wild guess, but from your description, it makes me think of some kind of lack of precicion in vertices screen position (it could be seen in quake2 md2 in idle animations). Are you using very very small coordinates, in float or int precision ?

V-man
12-09-2003, 10:08 AM
Originally posted by ZbuffeR:

Just a wild guess, but from your description, it makes me think of some kind of lack of precicion in vertices screen position (it could be seen in quake2 md2 in idle animations). Are you using very very small coordinates, in float or int precision ?

It should not matter as long as you dont have cracks, ie. instead of sharing a vertex or giving the multiple vertices the same value, you have multiple vertices with slightly different values.

To check for them, you can write a "proximity checker".

something like

small_value=1.0e-5;
if(abs(vertex1-vertex2) < small_value)
{
vertex1=vertex2;
}

T-junctions are another thing and your shadown volumes should not have them.

I just said T-junction cause you get the well known "crack appearing and dissappearing as you move the camera"
from them.

Dtag
12-09-2003, 12:12 PM
Hmm after having tested some more, it doesnt seem to have anything to do with the actual creation of the volume. I asked other people to test it and it seems to generally work on ATI... on the GF4 the lines vibrate in a different fashion, where the cracks are not as visible as on my GF3. So I guess it must have to do with the setup or something.
Btw: the size of the level/coordinates is nothing exceptionally small...

[This message has been edited by Dtag (edited 12-09-2003).]