Jump to content
Posted 07 November 2012 - 12:29 PM
Posted 08 November 2012 - 07:13 AM
Maybe have one shader for each lighting type?
I've been able to write per-pixel lighting shaders that can lighting features such as directional lighting, point lights, spot lights, and normal mapping support, however, I'm stuck on making this flexible.
I don't know about the performance of your system, but a deferred shader with tiled rendering for the lights could possibly minimize the amount of work for each light.
Now, each light takes up a certain amount of uniform and varying variables, so the more lights there are, the more data has to be pushed to the shader. This can be a performance issue if I have more than 1 light on-scene at once. With the iPhone 4S's hardware, I'm only able to compile shaders that have no more than 1 directional light, 1 point light, and 1 spot light since the hardware only supports so many uniform/varying variables. It I use more of these variables than the hardware supports, then it won't compile.