PDA

View Full Version : shadows aren't showing up



dirtmaster
07-09-2001, 02:32 PM
I've been trying to get some shadows to show up and I've been mimicking a program that works. My shadows are showing up at all and I've made sure I double checked the squish plane to be the ground . I noticed that not all of my polygons are wound ccw could this be a probelm. I don't know what I'm doing wrong the code is too confusing to post but if anybody has any common mistakes that beginners make I would appreciate it.

Rob The Bloke
07-09-2001, 03:05 PM
If you are projecting the polygons of the model onto the floor, make sure that if your model is drawn with back face culling on, set it to cull front faces when you draw the shadows. Secondly, if they are being drawn on to a surface that has already been drawn (ie, you've drawn a floor first and then the shadows are drawn on top, ensure that the depth test is set to GL_LEQUAL.

glDepthFunc( GL_LEQUAL );

if you are using shadow volumes, it may be the depth buffer or a problem with the stencil buffer.....

RedZen
07-10-2001, 04:03 AM
Hey there.
I had a similar problem.
Ok firstly make tripely sure youre plane is correct, cos that screwed me around for two days, I'm embarrased to say http://www.opengl.org/discussion_boards/ubb/smile.gif. OK despite what he said above, cos he probably knows more than me, also I had to render my shadow first and then the object that casts it. Otherwise I got my shadow cast onto the object. Maybe thats youre problem...

dirtmaster
07-10-2001, 08:18 AM
Thanks for the help guys I tweaked my normals and wound all my polygons the right way. I used the info you gave me but I'm still not getting shadows but instead I'm getting a black line which is a definite improvement. I need to start reading up on buffers because it seems that the problem probably lies somewhere there. If you know why I'm getting a black line rather than a shadow I'm all ears. Thanks for the help guys.

Talon
07-11-2001, 08:13 AM
Have you looked into polygon offset?

dirtmaster
07-13-2001, 07:46 AM
I got my shadows to work finally. I had to render the shadows first while not disabling glDepthTest(); and then rendering the other objects. I also had to render the shadows slightly above the the ground plane in order for them not to look choppy. I was wondering if thats the cheap solution to the problem. Can you reneder shadows in the same exact plane as you render the ground? I'm not famaliar at all with polygon offset what is that?

DFrey
07-13-2001, 08:33 AM
Yes, you can render two coincident, coplanar polygons, without getting z-fighting. One method is to use glPolygonOffset. That method merely adjusts the z value of the pixels before they are compared. It does not actually draw the polygon in a slightly raised position however. The offset is just for the testing purposes. Another method is to use the stencil buffer to mark where the ground plane(s) is(are) and to then draw the shadows with depth testing disabled, and stencil testing enabled so that the shadow is only drawn on the ground plane(s). It looks rather stupid however when a shadow appears to run under a wall rather than up a wall.