I have just implemented shadow maps in my application for spot lights (which is, of course, the easiest type for shadows).
My problem is: For shadow map generation, I use the cutoff parameter of the spotlight to calculate the perspective projection (fovy=2*cutoff). This way all objects that are relevant for the shadow map should be visible.
At least in theory, because in practice this is not true. If I rotate/move the light, objects that are still lit by the light are at least partially off the shadow map which makes their shadow incorrect (long dark lines or rectangles appear).
Is this logical? If it is, what can I do about it (other than to increase fovy which I would be reluctant to do because it also decreases shadow map detail)? Or is there a mistake somewhere?