D2X-XL Worklog
Notes on features and problems from the development of D2X-XL, newest first.
Renderer Improvements |
|
When playing around with D2X-XL recently, I noticed that with highest render quality, flying through smoke was "jumpy": The ship would get slower, then faster, then slower again in rapid succession. I immediately had the suspicion that this was due to loading of the depth blending shader that softly blends the smoke with the geometry to avoid hard edges, which happens at highest render quality. After having slept a night or two over it, I got the idea of completey rewriting the shader handling in D2X-XL. Until now, shaders had been created by each local function or code area that needed shaders, and book keeping of the currently loaded shader was coordinated via a global variable. This had been the result of the evolving usage of shaders in the program and was in dire need of being organized. So I wrote a shader management class that would allocate all shader programs and keep track of which shader program was currently active on the graphics card. This enabled me to conveniently look into shader switches. One effect of this was that I found that the renderer wasn't organizing the sequence it rendered textures very efficiently, causing a lot of shader switches, so it was improved (a side effect of this was that I discovered a bug here that I fixed). Still, the smoke depth blending induced slowdowns weren't fixed. Further investigation revealed that shader switches in the hundreds were generated when both smoke and energy sparks got rendered (which is the case quite frequently in D2X-XL type levels). The reason behind this was that depending on whether to blend transparency based (smoke) or additive (sparks), a different depth blending shader was used. Uniting the two shaders in a unified one handling both cases elegantly and with very little overhead was a simple task, and the reward was that shader switches dropped to 10 percent or less of what they had been before in that case. So D2X-XL v1.15 will bring a significant improvement of the renderer. I have to say that I am quite happy about this.
|



