So I've finally got all my shaders and blending figured out, and it's time to decide where the heck I'm actually going to do each part of my lighting calculations. I have a temporary system setup right now, where I render the single pass materials first, and for materials that use lighting, I simply render the ambient color in this pass. Then I render my forward lighting passes with additive blending in the next stage. What I'm having trouble deciding though, is what to break up into which passes.
I always see examples calculating ambient light in the same shader that forward lighting is calculated in, but that results in the unlit parts of the object being far too bright when more than one light is shining on the object. Is it a good idea to be drawing plain ambient color to the screen in the first pass and blending over that?
And for the lighting shaders, I currently have a seperate shader for rendering each kind of light. A shader for rendering a directional light, and a shader for rendering up to 8 point, or spot lights at once. Is there the potential to gain performance by just sending as many lights at once as possible, and then using branching in the shader to determine how to render them?
I don't need any concrete answers really, because obviously the "best" approach depends on the kind of scene I plan to render, but I'd at least like to get an idea of exactly what work is usually divided among which passes.