I know some of my friends working in AAA would be pretty amped about a 1 frame per second frame rate increase, but after four days work I was hoping for a bit better results.
Models in Miranda are edited in Blender, exported to Collada format, then a tool converts the Collada file to the LSG (Lair Scene Graph) file format. The old tool would convert each model component (body, turret, wheels, treads, etc.) into a vertex array and an index array (mesh.) The thing you might notice is that many models have several identical components (like wheels) and duplicating the renderables for each of those wheels is an inefficiency.
The idea then was to find the duplicated index arrays and vertex arrays and eliminate them. It didn't take too long to realize that completely eliminating duplicate index arrays was a non-starter. Miranda's renderer has a one-vertex-array-per-index-array limitation I wasn't willing to tackle. Luckily, most duplicate objects have both index and vertex arrays identical so this is not necessarily a big loss. In most models this optimization removed about half the number of renderables.
I was able to eke out one more optimization. Each model component specifies the material used to render it and different materials need different vertex data. Some need normals, some need the tangent, some need UV's, some none of the above. In the new system I would have one vertex array for each vertex format. The next step in the process was to figure out when I could combine all the differently formatted vertex arrays into a single vertex array without wasting too much vertex array space. I went with a 10% rule. If I could have just one vertex array and it didn't cost me more than 10% wasted space in the vertex array I would take it.
So while the rendering performance wasn't the big win I was hoping for, there were some small wins. The new model data on disk is about 2MB smaller which will improve load time, install time and misc AWS costs for me. I could gain a lot more by turning on compression of the LSG files, but until I add a system to preload models, load time is still a concern and decompression takes a bit too much time.
Another optimization I might try later is to combine all static objects in a model into a single draw call. The drawback of this approach is that the vertices and indices of duplicate objects are duplicated (although based on the small benefit of eliminating those vertices, the huge reduction in draw calls is probably worth it.)
The new models are now on the live server along with all the other bug fixes I've done the last two weeks so flowers are back, units are flowing better and I tried my new Insta-Deploy script today which worked great.
We were unable to retrieve our session cookie from your web browser. If pressing F5 once to reload this page does not get rid of this message, please read this to learn more.
You will not be able to post until you resolve this problem.