I am currently using per-pixel attenuated lights in my engine. I am having fill rate problems, so am trying to use scissor to limit the geometry drawn for each light.
I need to find the screen-space bounding rectangle of the sphere of influence of the light.
I am doing this at the moment by finding the vectors which will become screen space left and up, dx and dy.
Then I calculate centre+radiusdx, centre-radiusdx, centre+radiusdy, centre-radiusdy.
Then I mulitiply these by the modelview and projection matrices, and scale and bias so that [-1,1]->[0,window width] and the same for height.
However, using these projected values for the scissor box seems to make the box too small and at certain angles, it cuts off a lit part of the scene.
I think this method should work, does anyone have a reason why it shouldn’t?
Is there an easier way, or have I simply made a silly error?