Stencil shadow problem

i am having a problem with my shadows on my app,
they act normal but when you step into them they dissappear. what happends is that the front faces (of the shadow mesh calculated from the real mesh and light source) increment the stencil values and the back faces decrement them, when you enter the shadow volume only the back faces are rendered, how can i fix this so that the shadows render properly?? thanks in advance.

You need to switch to a depth-fail variant of the algorithm when the camera might be inside a shadow volume. The following article gets pretty deep into the whole thing:

http://www.gamasutra.com/features/20021011/lengyel_01.htm

– Eric Lengyel

Thanks, you have been a huge help.