D2X-XL Worklog
Notes on features and problems from the development of D2X-XL, newest first.
More Lightmaps |
|
After weeks of coding and testing it has finally arrived: True per pixel lighting for Descent 2! When you first start to play a level with per pixel lighting turned on, you may wonder what all the fuzz is about. Per pixel lighting does not look spectacularly different or better than per vertex lighting (it may do so in the future, should I add bump and parallax mapping). What per pixel lighting does is to produce lighting that very well corresponds to the position of brightness of light sources. That means that gun shots will produce nice round glows on all surfaces affected, and static lights will similarly produce a sphere of light around them that decays with growing distance from the light source. Lighting will be just way more precise than with per vertex lighting. There have been a lot of pitfalls and things to work around to make per pixel lighting work with Descent. One problem are the lights that simply consist of a texture glued on a face. There is no way to have each lamp on a face emit light separately, and simply placing the light source in the face's center doesn't work either, as the face's periphery in most cases would be way too dark. So I had to find a way to light entire light texture bearing faces and still make it look plausible. Another problem is the excessive amount of light sources in many Descent levels. The lighting you see in standard Descent mines does not physically correspond to the number and brightness of light sources present. Add the huge number of lights an intense fire fight can produce on top of that, and you start to have a problem. I have found that in some cases over 30 light sources per face need to be processed to avoid lighting flaws. You can blame this for all cases of excessive saturation. To obtain as much speed as possible despite of all these problems, I have done a lot of tests and optimizations, built shader programs that could process variable numbers of lights, created algorithms to sort faces so that the number of texture and shader program switches are minimized, devised methods to reduce the number of light sources produced by gun fire, reduced the number of lights processed per face ... One thing helping both speed and visual quality very much are lightmaps which work perfectly together with dynamic per pixel lighting. I have covered lightmaps in another worklog article already. While I am finding the result of my effort visually very pleasing, you will have to live with a hefty performance penalty when using per pixel lighting. There may be light rendering methods better suited to the excessive amount of light sources present in Descent, but I had to get into regular shader based per pixel lighting first, and these methods require some pretty advanced hardware (well, my current implementation does that, too, but for different reasons). I found per pixel lighting to run acceptably well on machines equipped with Athlon 64 3500+ CPUs and Radeon X850 XT and X1900 XT graphics cards, but you probably won't get very happy with it with anything weaker than that. If there are few variable lights around, lightmaps will help to speed the rendering up very much as they are precomputed and simply need to be blended with the geometry. If you follow the advice from my worklog entry "Speed And Light" (where you will also find details regarding per pixel lighting settings) and have a sufficiently powerful hardware, per pixel lighting should work acceptably well for you. So far so good. Enough of the talking. You can now play around with it and see for yourself. |


