Saturday, June 19, 2010

Submit, Batch!

It's always a good sign when you're writing a new renderer if you're able to replace 50+ lines of code from the old one with 3 new lines, and still accomplish exactly the same thing. That's exactly what happened when I just ported over the code for drawing alpha brush model surfaces. It was quite pleasing and definitely indicates that I'm on the right track with things.

The only major remaining item from the main 3D render is alpha liquid surfaces. I'm kind of dreading these as the original code I had written for 1.8.0 turned into quite a tangled mess. I had cleaned it up a little over subsequent releases, but the core horribleness remains. I suppose it's an opportunity to finally gut it and do things right.

Another pleasing outcome is there's now going to be a grand total of one drawing routine in the entire engine that handles everything. It's definitely safe to say that at this point in time, as we're at such an advanced stage in the porting job that there is no question whatsoever of it being otherwise.

Finally for now, I may be experimenting with removing multitexturing from the surface refresh. The reason why is better batching. I think it's going to be 50/50 whether or not we get improved framerates overall from this; one the one hand multitexturing has the advantage that you can do everything in a single pass, whereas on the other hand not multitexturing enables you to batch your vertexes more efficiently.

Now, DirectQ does certain things (some of which are unspeakable) to enable reasonably good batching with a multitextured renderer, but with the way Quake texture/lightmap interaction needs to be set up, it will never be as good as a non-multitextured render. The question is if the gain from better batching offsets the loss from drawing all surfaces twice. In GLQuake it's frequently "yes", but the answer is not so clear-cut with DirectQ. We'll have to find out in other words.

I'll update on how that goes when I get around to it.

0 comments: