I’m having a little issue working with lights and shadows currently.
I think it may be what’s called self-shadowing but I’m not really sure (for starters, nothing from this topic worked: [url]preventing objects from self-shadowing]).
As it turns out the shadows also look kinda weird. They’re a bit blurry, but setting the values of the shadow caster, I only managed to get no shadows at all, blurry shadows like that, and blurry shadows much much bigger than they should be.
So, is this self-shadowing, or does this come from the values I pass to the light ?
Self-shadowing issues usually occur when you have doublesided faces, is that the case?
In any case, the depth map resolution is rather horrible, so you should consider setting the film size and possibly the view distance (far-near) to a lower value. Use showFrustum to show a visual representation of the frustum, and then adjust the values to make the frustum as small as possible by adjusting the film size and near/far planes.
Also, your sun is positioned at ground level (z=0), you should probably adjust that.
Hey ! It’s been a while but I’m back on this topic and worked a lot on it.
I have much better results following your adivces (the shadows are looking good now), but I still have self-shadowing issues.
I did a window->get_render()->set_two_sided(false);
Shouldn’t it resolve these kind of issues ?
I also realized that the self-shadowing only happened on the models I made myself.
Maybe they have doublesided faces indeed. I’m so bad at modeling I wouldn’t have noticed if I did it myself.
set_two_sided doesn’t override this for models that are loaded, since they simply get duplicate faces (with one set reversed). Check if your models are double-sided using pview and then using the option to enable back-face culling (‘i’, I think), and if the model doesn’t change, it must have double faces.
Alternatively, you could try and see if set_depth_offset(1) on your double-sided model does the trick.