D2X-XL Worklog
Notes on features and problems from the development of D2X-XL, newest first.
Shadows Revisited |
Shadow MappingSince I was never too satisfied with the shadow implementation of D2X-XL, and since shadow mapping seemed to be the proper cure for the problems that plagued it - and the method I had been using (volumetric stencil shadows) in general - I have had it in my mind for a long, long time to look into it. Recently the day to make this true had come. I had some difficulties in getting the required math right (which was more of a problem of understanding how OpenGL handled this than understanding the underlying math), but with the help of some knowledgeable members of the OpenGL.org forums I managed to take that hurdle and implement some basic shadow mapping in D2X-XL. You can see the result here: ![]() I quickly hit the limits of a basic shadow mapping implementation though. Depending on distance, shadows looked very pixelated. The view angle of a shadow map also is quite limited, so I would either have to render five or six shadow maps per light source or use a parabolic projection for it. Digging deeper into the subject quickly revealed to me how deep that rabbit hole really is and how far I would have to go to produce high quality shadows using shadow mapping. If you are interested, you can find out about that yourself by reading these documents: Have fun.
|
Volumetric Stencil ShadowsWhile I had been thinking about a good way to implement shadowing in D2X-XL in general (where you are having an excessive amount of light sources), I had had an idea how to improve on the current formula of chosing the brightest light source next to an object for casting that object's shadow: Only dynamic (moving) light sources would create shadows. This would limit the light sources mainly to gun shots, creating a very plausible and credible shadow effect. Since I now also have a blur effect in place, creating soft instead of the previous hard edged shadows (something which is typical for volumetric stencil shadows) was easy. See the result of my efforts here: ![]() I have to admit that I am still cheating a little with these shadows: Instead of rendering the light contribution of the lights used for shadow casting and masking it off using the stencil buffer, I render a dark rectangle over the entire output window and mask it off. The further method would require deferred lighting with all the extra math and data coming with it. Actually I am having everything needed for implementing deferred lighting available in D2X-XL, but I am shying the effort right now. I hope you still like the improved look and behavior. |




