D2X-XL Worklog
Notes on features and problems from the development of D2X-XL, newest first.
Improved Headlight |
|
The current headlight implementation suffers from two flaws, depending on the light renderer used. With the legacy lighting, the entire mine around the
player simply gets lit up and the headlight reaches very far. That's an acceptable compromise for the days when the D2 engine still was young, but not today.
The OpenGL style lighting allows a conical light beam, only illuminating what is inside the cone, but that sounds better than it is: If you get close to a wall, you can observe the wall turning darker and darker. The reason for this is that the OpenGL style light renderer only computes the light for each face's corners, and the light for each pixel of the face is interpolated using the corner light values. Closing up to a wall also means a greater angle between headlight and corners, dimming the corners' light. That means that you could end up facing a pitch black wall even with the headlight directed straight at it. To make a long story short: Modern graphics hardware allows a way around this by computing the light not just for each corner of a face, but for each of its pixels using a shader program, and that's what I have built into D2X-XL now, giving a nice, round headlight shine with a soft peripheral glow. Of course this method has a backdraw: It may not run on older graphics hardware (well, pretty old one), and it can slow the renderer down significantly, depending on the potential number of headlights (1 in singleplayer, 4 in coop, 8 in other multiplayer game types). It can therefore be toggled; find the switch in the lighting options menu. Here are a few screenshots to give you an impression. Note the specular highlight on some surfaces.
|







