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.
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).
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.