D2X-XL Worklog
Notes on features and problems from the development of D2X-XL, newest first.
Lightmaps Revisited |
|
When making a sight seeing tour through a few of my levels recently, I noticed that in certain areas lightmap based lighting looked just horrible. This was most noteable in places using very irregular segment shapes. My first thought was to simply ignore it and use per vertex lighting instead - but I just cannot live with something like that. So I set out to fix lightmap calculation, and the more I looked into it, the more I understood how horribly flawed my implementation had been. There was no easy fix, I had to completely rewrite it. It was quite an effort to get this done right. Many of the optimizations I tried to implement to speed up lightmap calculation proved faulty and had to be dumped. Even when I had the (simplified) physics math right, ugly effects owed to the segmented structure of Descent levels cropped up, forcing me to develop methods to remove the resulting lighting artifacts. I had to work around numerical errors based in limited floating point precision which caused ugly artifacts. I even replaced a ray tracing based collision detection function stemming from the original Parallax code, which had been coded to the book, but had been using an inefficient algorithm. My core lighting code has been simplified and improved in the process as well, making it faster and easier to understand. In the end I finally succeeded, and D2X-XL computed nice looking light maps, properly accumulating light contributions from different light sources casting their light from different distances and angles, and creating nice shadows. The only remaining problem was that huge faces had visible jaggies at shadow borders, because the lightmap resolution was too low for these faces. Fortunately, I had added a blur shader to D2X-XL a while ago to support glow rendering, and this came very handy for gently blurring lightmaps, which now look quite fabulous in my eyes, and finally and for the first time produce real good and convincing lighting for Descent mines. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |














