View Full Version : Shadow mapping artifacts behind the light
02-02-2009, 03:44 AM
apart from my little 2D game, I'm learning 3D with OpenGL. My shadow mapping is almost working fine but I can see various shadow artifacts behind the light. It seems with using shaders it's easy to remove them but I'd like to know if it's possible and how to remove those artifacts without using shaders.
02-02-2009, 05:43 AM
Use glPolygonOffset() when rendering the shadow map.
(...if we mean the usual shadow map artifacts here...)
02-02-2009, 06:33 AM
I already use glPolygonOffset.
What I meant is that I can see the shadow behind the light, thing that should never happend. So I have the shadow twice, once in front of the light, which is good, the seconde behind the light which is "bad mapped". (sorry for my poor english and bad explanation).
02-02-2009, 09:20 AM
You have to set up a clip plane to stop any polygons from rendering behind the light.
02-05-2009, 08:01 AM
Thanks for the tip.
I did it but as I expected, all things behind the light is not lit but full shadowed.
Should I use another pass to render what's behing the light ?
02-05-2009, 09:09 AM
I assume you are using a spotLight, with only one shadowmap.
You have two solutions:
1/ You go for a pointLight, which will lead you to render two shadowMap (one for the front and one for the back of the light, setting a fov 179.)
2/ In your GLSL, you test the w coordinate of the vertex after transformation. If it's <0, then just drop the shadow calculation and apply ambient lighting only.
02-05-2009, 09:50 AM
I guess I'll go on for the 2 shadow maps.
I don't understand your second method, but since I've not still have learnt shaders, just forget it.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.