randomPoison / gunship-rs

An experimental game engine written in Rust.
MIT License
27 stars 3 forks source link

Draw Multiple Lights In One Draw Call #68

Closed randomPoison closed 7 years ago

randomPoison commented 8 years ago

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.

randomPoison commented 7 years ago

Completed by 31fcafe.