I would like to support a few different lighting models in my deferred renderer, such as: Phong OrenNayar and Cook-Torrance, so a small limited set to support a bit more than just a single lighting model.
What i came up with:
The most obvious way seems to simply branch in the shader based on some information stored in a texture during the geometry pass. I have come to learn however that branching in shaders is generally a bad idea (at least that's what i read everywhere). So I came up with a branch-less version by using the stencil buffer to mask each of the few shaders, and rendering each light multiple times, once for each lighting model. (The stencil buffer could be filled during the geometry pass and then stored in R8, and with some trickery you can use it as well for light masking.)
Now the question is, what is the best way to do this? Did I miss any better techniques? I could not find many usefull sources online.