D2X-XL Worklog
Notes on features and problems from the development of D2X-XL, newest first.
Smoke Again | |
|
On my never ending quest of improving D2X-XL ... errm, did I say that before? I found a kludge by determining whether the smoke emitting object was moving to the viewer or away, and that helped somewhat ... but not in all cases, so I wasn't satisfied. After a lot of pondering on the issue an ingenious thought struck me like a flash of lightning: The solution was not to sort the particles at all! Well, at least not as brute force as I had tried before. All I needed was a depth buffer managed by the program where I could 'stick' the particles on depending on their distance to the viewer. To keep the depth buffer reasonably small, I needed to do some scaling of the depth (Z) coordinates and implement a simple collision hashing for particles at the same (scaled) depth. The implementation was really simple, and it proved to finally give me smoke effects in the quality I had always desired and at absolutely great frame rates. Even sorting particles at the same scaled depth according to their actual distance from the viewer didn't noteably hit the frame rate. Actually I couldn't even see it improving visual smoke quality any further, but I just left it in as an option for the heck of it. A disclaimer: The new rendering method will not increase general smoke rendering speed. So if a system is to weak to offer a lot of fill rate, smoke
will still slow down the game. But if your computer could handle smoke in D2X-XL before, it will now look much greater. Because a picture says more than a thousand words, I have prepared around 3.75 million words (the equivalent of a 2:30 video clip at 25 fps | |



Anyway. Did you notice that ugly 'tunnel'
effect when looking into the smoke trail of a missile you had fired from your ship? I did, and I didn't like it at all. I had made quite a few attempts to
get rid of it, but none of them had been successful. The problem behind the issue was that the smoke particles had to be rendered according to their distance
from the viewer, farthest first, and I just couldn't think of a way to sort a couple thousand particle positions so fast every frame that I'd still achieve a
decent frame rate.
)
for you (the low frate rate is due to video recording with Fraps):