I am currently working on writing a shader for combination lighting. The idea behind it is to apply directional light, point light, and spot light in a single pass. I believe I can do this by:

• Calculate the color after directional light is applied.
• Calculate the color after the point light is applied.
• Calculate the color after the spot light is applied.
• Return the final color of the pixel.

I believe this will allow me to have multiple point and spot lights that effect the pixel currently being handled by the pixel shader.

I believe the math for this will be:

return directional + pointLight + spot;


However, my concern is that this will create just a solid white object and I am unsure as to how to prevent that. Maybe each portion is normalized to a specific percentage of full intensity and the result would be:

directional = calcDirectional() * 0.3f;
pointLight = calcPoint() * 0.3f;
spot = calcSpot() * 0.3f;
return direction + pointLight + spot;


But again, I am not 100% sure on this.

What is the proper way to additively calculate colors in this scenario?