rendering axially symmetric shadow volumes with double sided stencil: issues

i’m slightly irritated, and am hoping some contributor might be able to offer a creative solution to this dilemma of mine.

the thing is i’m rendering axially symmetric geometry. naturally it is apropriate to divide the geometry in symmetrical halves so not to duplicate the memory overhead redundantly.

an issue arises with rendering shadow volumes. and i believe the issue only pertains to doing so with a double sided stencil buffer. you see when the geometry is divided the polygons that would be inside the geometry are discarded leaving open edges. now i don’t think the open edges in themselves are the problem because after both sides are rendered they are essentially closed in the buffer. but there is a slight ovelap along the seem which reverses the stencil value projected from the seam about 1 pixel or less thick. creating runs in the final stencil image.

i tried offsetting the geometry slightly to so that the halves do not overlap to no prevail. i’m not really sure if the effect is due to the openness that is if the halves were closed, capped, i wonder if that would eleviate the problem.

are there no stencil function parameters which might alleviate this?

any advice would be greatly apreciated.

michael

the “z pass” method appears to be better in this respect contrasted to “z fail”. still there seems to be conditions in which the two shadows will intersect and invert the intersection to the oposite of the two shadows when they should union. i don’t pretend to understand the mechanics of this. i would be interested in any suggestions regarding the matter.

michael

Long:
Your main problem probably is that you count the common vertices (at the axis) twice and you get slightly different results.
If you give give the same coordinates there then you mustn’t get any overlap (OpenGL spec).

Short:
Don’t mirror the vertices that are on the axis.

I hope this help:
Csiki

Originally posted by Csiki:

Long:
Your main problem probably is that you count the common vertices (at the axis) twice and you get slightly different results.
If you give give the same coordinates there then you mustn’t get any overlap (OpenGL spec).
Csiki

i don’t follow, if i give the same coordinates then there will not be overlap according to the specs you say. i can assure you they are the same coordinates as each side shares the same memory. the latter side of course goes through an extra mirror scale transform. but the real issue here is that i don’t understand why overlap should cause intersection effects in the stencil buffer. it seems clear that this is not always the case as ususually the shadows union, but their are instances were intersection such as this occur. is this stencil buffer overflow or something else?

Originally posted by Csiki:
Short:
Don’t mirror the vertices that are on the axis.
Csiki

i don’t follow. do you mean to duplicate the axial vertices? this would not be possible. besides i tried slightly offsetting the shadoww volumes slightly to no prevail.

best regards,

your concern is much apreciated.

michael

Originally posted by opengl_enquirer:
i don’t follow…
the latter side of course goes through an extra mirror scale transform. but the real issue here is that i don’t understand why overlap should cause intersection effects in the stencil buffer

As you wish. Then you will NEVER solve this problem.
When you mirror you vertices on the axis (too) they will be changed a bit (don’t remain identical), see with a debugger. THAT’s why you get overlap effects, because you have two objects with a small distance between them.

Csiki

If you cap the open side of your mesh (i.e. the side that’s on the mirror plane), and then slightly overlap the two halves, it should work. This may add quite a few polygons to your model, though.

– Tom