The current method for drawing multiple lights is a bit convoluted and highly inefficient; We draw the mesh once with no light to get a flat base with only the ambient color, then we turn blending on and draw once with each light to aggregate all light sources. The advantage of this method is that it supports an arbitrary number of lights, the downside is that drawing n lights requires n + 1 draw calls, which is completely non-viable under a reasonable workload.
There are several lighting models we can use to solve this, and chances are we are going to want to support multiple lighting models. A good place to start would be a proper forward lighting model. We'll need to do some research to determine a reasonable implementation first.
The current method for drawing multiple lights is a bit convoluted and highly inefficient; We draw the mesh once with no light to get a flat base with only the ambient color, then we turn blending on and draw once with each light to aggregate all light sources. The advantage of this method is that it supports an arbitrary number of lights, the downside is that drawing
n
lights requiresn + 1
draw calls, which is completely non-viable under a reasonable workload.There are several lighting models we can use to solve this, and chances are we are going to want to support multiple lighting models. A good place to start would be a proper forward lighting model. We'll need to do some research to determine a reasonable implementation first.