D2X-XL Worklog
Notes on features and problems from the development of D2X-XL, newest first.
Speed & Light |
|
Well ... I wish D2X-XL would run at the speed of light, but as of now the "of" is just an "and".
Given the small number of faces that get rendered per frame even with the biggest D2X-XL mines, D2X-XL should be ten times faster ...
forgive me for not being John Carmack (and forgive John Carmack for not doing Descent 4. Per pixel lighting is close to being released, and in the course of implementing and polishing it, I have also done a lot to speed up the renderer by identifying and removing bottlenecks and minimizing OpenGL state changes. I have been quite successful in ramping the speed up to almost twice of what it was before, and I have found out three crucial elements influencing the rendering speed. Number of visible variable light sources Variable light sources are all lights that can or do change their position or brightness, i.e. destructible or flickering lights, objects, missiles and gun shots. These are the most difficult to handle. What basically needs to be done here is to reduce the number of variable lights per vertex as much as possible. The D2X-XL code has been improved quite much in this area. One thing that can be done by the user and which can help big time is to turn off powerups as light sources in the light options menu. In the default setting, powerups are weak light sources. That means that while they don't affect their enviroment very noteably, they can slow the renderer down mightily if present in big numbers. I have found out that not having powerups be light sources usually doesn't decrease the visual experience of playing Descent at all, as powerups still get lit and their brightness can also be enhanced by giving them a corona if desired. Number of light sources affecting an object I highly recommend to enable hardware object lighting as it is way faster than software lighting. Hardware object lighting has one backdraw though: You can only use as much as eight hardware lights simultaneously. As soon as you have more lights influencing an object, you will have to render the object several times, adding the colors and brightness up, and that really hurts the rendering speed with many objects around. Setting max. light sources per object to eight is a good way to get around this and usually also doesn't compromise the visual gaming experience. High resolution objects There isn't much I can do regarding high resolution object rendering speed as (apart from vertex buffer optimization) I have already done everything to speed this process up as much as possible: D2X-XL is using the fastest data organization and OpenGL render functions known to me and decreases the number of state changes (i.e. loading of different textures) as much as possible already. As explained above, setting max. lights per object to eight can already produce a significant speed gain. If that isn't enough, consider turning high res objects off (you can do that by disabling them in the object render menu). Doing that can triple the frame rate with many objects around. Per pixel lighting considerations Something I want to mention a little ahead of time is handling of per pixel lighting. With per pixel lighting you can control the number of lights per pass (i.e. lights simultaenously used when computing a face's light) and the total number of lights per face. As with object lighting, the max. number of lights per pass is limited to eight by the hardware, and this is also the fastest setting. Depending on the max. number of lights per pass and per face D2X-XL will also need to draw a face several times to produce the final lighting for it. Of course, this will also slow the renderer down. Ideally, the max. number of lights per face should be equal or slightly greater to a multiple of max. lights per pass (like e.g. 24 which is 3 * 8 or 20 which is close to 21 = 3 * 7). I have found that anything less than 16 lights per face can cause lighting flaws which will start to appear very frequently with less than 8 lights. I have also found out that you will need quite a good hardware to be able to enjoy per pixel lighting with D2X-XL. While you can certainly blame my lack of greater expertise in the field of rendering algorithms for this, it is also due to the excessive number of lights present in a typical Descent mine even if there aren't any additional light sources like gun shots around. There are algorithms to get around this, and I may implement deferred lighting in the future, but no promises. |



)