I'm confused about the mathematics behind additive blending used in conjunction with Phong shading. Intuitively, it seems like you would need to use a floating-point framebuffer and some sort of tone-mapping to achieve the actual approximation of many lights. Since the lighting values are computed as diffuse + specular
, multiple lights can be encoded as:
finalColor = ambient
for light in lights:
finalColor += light.specular + light.diffuse
Now, suppose you have multiple white lights shining on a perfectly diffuse, but mostly red sphere. The more lights you add, the closer the final rendered sphere should get to the actual color of the sphere. In this case, if you use an 8-bit RGBA framebuffer, then rendering with glBlend(GL_ONE, GL_ONE)
will actually cause the sphere to reach a white color in the limit, similar to the effect outlined in this question.
My question is twofold:
- Is my intuition here correct?
- If so, how do you combat this situation? If not, why not?