Tuesday, April 13, 2010

Entity Occlusions and Lightmaps

It's been a very productive evening for DirectQ with a number of long-standing matters having finally been cracked. The big one is the entity occlusion flip/flopping that I mentioned earlier. This was coming from code that I had written to reuse query objects as soon as they go idle. You may recall from a couple of months back that I had mentioned I was getting hundreds of thousands of queries in some maps. However, I was solving the symptom and not the cause, which was that lightning bolts were generating a huge amount of query objects which would never be picked up on again. The simpler and far more elegant solution was to just not generate queries for lightning bolts at all.

Because of this I have been able to remove a lot of formerly ugly code and revert back to a simpler way of doing things in certain parts of the system. The flip/flopping problem is completely resolved and I have gained quite a substantial performance boost in scenes with high entity poly counts.

I've also been digging some more at lightmaps and have finally uncovered what seems to be the "correct" way of handling lightmap updates. Another large framerate gain came from that. There's not much to be said about this that isn't deeply technical, but it does highlight a serious hole in the D3D documentation. There is a need for a section on "common scenarios" with advice on the correct way to do them. This is the third or fourth such scenario this year where I've had to piece together information from multiple different sections, put 2 and 2 together, take a leap of faith, upset elements of the renderer, and finally come out the other side.

These are all problems that everyone needs to solve all over again for themselves every time, and it's Just Not Good Enough.

The good news however is that tomorrow's planned release is virtually certain. It will be late-ish in the evening (GMT) as there are some small things left to finish up, and I also need to give the engine a good shake-down by playing some Quake.

Traditionally I play through e1 on Easy to make certain that everything works as it should, but this time I think I'm going to do e3, just for a change.

0 comments: