I'm amazed by the almost complete lack of material on modern shader lighting permutation management. There are people who are doing it (or have done it), like for example Epic and Offset Software, there have been some brief discussions on the subject on various forums (such as GD Algorithms) and a short article on Gamasutra, but that's all I've been able to find. Sufficient, yes, but it makes you wonder how many are still doing these things 'by hand'.
The Open Source rendering engines I've looked at still use the shader solution of "insert complete source code here", i.e. don't even begin to attempt to address the problems of light source management for shaders. None of the demosceners I've spoken with on the subject have attempted to implement such a solution before, either.
Oh, well.
Right now I have the Phong part of the RenderMan lighting interface up and running, with ambient(P), diffuse(P, N) and specular(P, N, s) functions. They're currently doing their work in camera space, which is wrong, but I'll need to decide how to pass along the necessary transforms for world space calculations before changing that.
Next up is an emulation of the illuminance() clause, where you call illuminate(P, N, a) and get calls to your illuminance(L, Cl) for each relevant light source. That isn't as nice as the original, but it'll work just fine. I'll need to read a bit more about RenderMan SL before finishing it, though. Both of these sets of functions will be provided for each permutation. They don't take very long to generate and compile, and it cuts down on the complexity of the management code.
I've now moved the game onto the new pipeline, and everything works except for the skydome. For some reason it doesn't render, and yet everything claims to be working just fine. Hmm, annoying that. Adding more debug code.

0 comments:
Post a Comment