PDA

View Full Version : Any better way to do shadows in OpenGL (as opposed to stencil shadows)



BigShooter
08-16-2003, 06:32 PM
I just did Nehe's tutorial lesson 27. It describes using a stencil buffer to do the shadows... I didn't quite understand that lesson (code wasn't commented best either) and I've found the stencil shadows to be quite hard to understand. Isn't there a better way to do the shadows? Any tutorials out there?
Perhaps an extension that would simple allow for 'glShadows(TRUE)' :-) and everything would be done automatically? I wonder if or why not such extension is or isn't available...
Thanks again,
Luke

rhem
08-17-2003, 12:51 AM
They should do that. I saw one extention but its not on my card. http://www.opengl.org/discussion_boards/ubb/frown.gif Did hard shadows anyways not soft.

PanzerSchreck
08-17-2003, 12:57 AM
There are no extensions that just enabled shadows, but there are some extensions like GL_ARB_shadow and GL_ARB_shadow_ambient which are usefull for shadowcasting via shadowmaps.
Projected Shadowmaps are easier to implement than volumetric stencil shadows, so you may loo k at this kind of shadowing.There's a sample-application for this technique including Sourcecode on my page, but it's coded in Delphi so it won't be of much use for you, but projective shadowmapping isn't that hard.
But it has some backdraws, like problems when the object exceeds the frustum of your lightsource and heavy artifacts depending of your shadowmaps size.
If you only need static shadows, then take a look at lightmaps with precomputed shadows.