Still having problems with shadow mapping in fragment programs

Thanks to everyone which replied to my recent thread about the 32 zBuff. I really appreciated so much feedback.

After a while, I finally managed to get my shadow mapping VP/FP program work. Right now, it’s able to do some pretty good renderings sometimes.
The really ugly thing is that I’m having some problems - I guess they are somewhat related to insufficient z resolution but I may be doing something bad.

I guess someone already managed shadow mapping with vertex/fragment programs so I would like to get some hints on other possible causes.

1- "Complex" object not self-shadowing
2- Not shadowing at all (see mid-screen)

I have some hints this may be fixed by moving the zNear plane away (right now, I’m using zNear=2, zFar=50 on a 24bit depth buffer).
I would be quite happy if you could confirm this is just a problem of z precision.

I am reconsidering shadow buffers in favor of shadow volumes - after this experiment, I realized projecting the shadow map has some issues when the “eye” is close to a light source. This is not a problem for projective texturing in general but it is for projective shadow mapping.
I guess this counterbalances shadow volume’s problem of being a per-vertex operation (which I guess could be solved in a way).

I am somewhat disappointed that I was not able to find that mentioned in any whitepaper since this in my opinion is a severe limitation.

Thank you in advance!

MULTIPLE EDITS: you really don’t know how much I hate this UBB code.

[This message has been edited by Obli (edited 09-23-2003).]

[This message has been edited by Obli (edited 09-23-2003).]