I'm looking into converting my forward-renderer into a a deferred renderer, but there's one problem that I can't find (or can't conceptualize), and that is how all of the lights in the scene are accumulated. In forward rendering, I would upload all of my lights to the shader, but I was limited to 4 due to the size of varying objects. How do I get the accumulated light information to my final composite shader? Do I render each light in a similar manner to how each scene object is rendered? I've seen some examples that render each point light as a sphere, but I can't see how this method allows for attenuation.
1
votes
1 Answers
4
votes
The idea of deferred shading is, that you do the lighting calculations in one screen sized image operation per light, i.e. for each light do a own deferred shading pass. Light adds up, so you use a additive blend mode (no alpha channel, just sum it up). That's also the reason why deferred shading only works well with opaque geometry and requires additional preparations (like depth peeling the scene) if to be applied to translucent geometry.