Modelling and texturing for performance

Of course every designer has read the excellent blog posts by Adrian Woods on how to optimize your performance by now. If not I would say do so now: part 1, part 2, part 3, part 4

So after having read that you know that polygons do not matter so much, it is the amount of texture vertices that the graphical card has to draw that matters. And also the amount of drawcalls is very important, so we need to minimize them. That means putting all your textures on one sheet if possible and don’t change the shader parameters (material settings) when that is not needed. So also for just a colour surface where we used to use a material sometimes, it is better to use a piece of your texture.

But that is all theory you might think, what will it bring me if I model like that? I had the same question, so today I tried to figure out what the benefits could be. So what I did is that I took a model of a church that I made 2 years ago or so. Recently I had updated it to FSX materials already, but I did not change the amount of materials. So it was using 8 textures for this church and besides that also 3 coloured materials. So in total it would need 11 drawcalls just to draw this church.

So today I tried to optimize this church based on all the tips Adrian provided (and on the DevCon he also gave a interesting presentation about this). So I combined all my textures in one big 1024×512 sheet (I did not need the size of a 1024×1024 for this one). In there I also added some coloured areas to replace the materials I used before. So now I could draw my entire building with this single texture, so it needs only 1 drawcall.

So then it was time to measure the performance difference. Because one church does not really hurt my PC (although I tested it on my 3 year old laptop), I decided to place 25 of them in a nice 5×5 grid. I did place these churches in the middle of the ocean so that I was only measuring my churches. So here are the results:

Empty sea: 17.0 frames
25x Non-optimized church: 12.2 frames
25x Optimized church: 15.0 frames

The performance gain was a lot bigger than I had actually expected and this clearly shows that following the tips of Adrian is a very wise thing to do. As I tested this with Acceleration installed, I guess the batching of objects that is contained in Acceleration/SP2 might also show its power here.

A funny fact is even that my “optimized” model has more polygons than the old one. In the old model I used a few repeating textures, but now I decided to add a few more polygons for that, so that everything fitted better on my texture sheet. So this shows that the amount of polygons is not the most important part when it comes to performance, the drawcalls that is what matters. So watch your drawcalls from now on!

Leave a Reply

Your email address will not be published. Required fields are marked *