Page 1 of 1

Slight problem with shadows.

Posted: Thu Jun 09, 2005 4:34 pm
by Tenko
Hello,

I'm rather new to OGRE, and while I was running a few tests on it for myself today, I noticed that there appears to be an odd problem with the stencil shadows. They act fine until I step really close to the model (the OGRE head, in this case), and then the rendering goes haywire - strange shadows seem to pop out of it, and parts of the head seem to disappear.

Since I don't know much about this, I'm not sure if it's a problem on my end, or something else. I googled a little, and I thought that maybe this was because of the shadow volume algorithm that OGRE's using (I'm assuming it's a z-pass algorithm) - is this the problem that the z-fail algorithm is supposed to fix? And is there any way I can get around this?

A few screenshots:

There are three lights, one red, one blue, and one green, so the shadows cast are colored except in the middle.

#1 - Everything seems fine when I'm outside of the shadowed area.
Image

#2 - Things start to go a little weird.
Image

#3 - Large sections of the model start disappearing, in addition to the shadow strangeness.
Image

EDIT: Added pictures in to clarify.

Posted: Thu Jun 09, 2005 6:06 pm
by sinbad
OGRE already uses many, many techniques including zfail to make sure the stencil shadows are correct. Passing into / across the shadow volume is no issue - try it in the demos if you like.

However, if you're using older cards (GeForce3/4 on DirectX, or earlier for example), certain 100% protections aren't possible and you just have to be careful with your light and camera parameters to avoid issues. This is because these cards cannot do infinite extrusion and/or infinite camera projection, which means you get problems with shadow volumes poking out the back of the far plane. On better cards, or on the 'transition cards' like Gf3/4 with GL, this is all handled by infinite projection. So, like in the demos, you need to be a little careful with your parameters to avoid these issues, don't assume they're automatic.

This is covered in the shadows section of the manual.

Posted: Fri Jun 10, 2005 3:46 am
by Tenko
Hrm. I apologize for not having read the manual well enough. I've just reread that section, and it seems that it should work fine on vertex-program capable hardware. I'm running on a GeForce 6800, and using OpenGL, so I don't think this should be a problem. Am I missing something obvious?

Posted: Fri Jun 10, 2005 9:09 pm
by sinbad
Very odd - do you have the latest drivers? I'm running an FX5900 here and cannot recreate these problems. Can you recreate them with the standard Demo_Shadows? It does look like near-plane clipping but whenever I do this it works fine. Are your camera settings unusual?

Posted: Sat Jun 11, 2005 4:29 am
by Tenko
Hmmm. Odd. I did a few more tests, and then I realized that I hadn't set a near clip plane distance - I set it to 5, and the problem disappeared. I took out the near clip plane distance and the problem came back. Seems that it's got something to do with it. (The shadows demo works fine.)

I can post any parts of my code here if necessary. This seems to be a rather odd problem to me.

Posted: Sat Jun 11, 2005 10:25 am
by BlasterN
I dont know how you can do it (or your card do it)... but

how many light do you have? seems like you have 3 lights & misterously you set 3 diferents tipe of color shadows....

BTW try other model, i read in the post that ogrehead model are bad exported (bad uv ot something like that). try the athenea,mesh instead with the same scene & post the creen result.

Posted: Sat Jun 11, 2005 1:53 pm
by Tenko
3 lights, one red, one green, and one blue. The shadows are in the right places - I was seeing if it did colored shadows right. The technique used is additive stencil shadows.

I'll try the other model in a little bit when I've got time. Thanks for the suggestion.