Alien Blitz 3d: optimizing meshes, new performance tests, removing textures

Optimizing meshes

I knew I had to optimize meshes at some point, but I was a bit too lazy to do it up to now…

Models in Alien Blitz come from Qubicle, I was not using the qubicle tool to export wavefront object as I wanted to remove faces looking down, other than that results were the same… with lots of vertices/polygons/…


(1760 faces on this model)

I was too lazy to do optimizations as I had to review the way the wavefront object was created and work with faces instead of cubes… thankfully it didn’t take too long.

Basically the tool is reading the qubicle object, extract all cubes, and then build a list of all cube faces that need to be saved (those that are visible)

Then this list is optimized (removing faces of the same color, with the same normal), and all faces are saved to the final object.

First optimization was quite easy, just try to rendre some 1x2x1 faces instead of 1x1x1 where possible


It worked pretty well, so next optimization is to try to render the maximum area of faces with same color/normals


And apply the same algorithm everywhere


(92 faces on the same model now)

The algorithm is not optimal, it just try to find a suitable area and move to the next faces, theoretically it should check all possible faces for the best area, but this would take too much time. Another thing is this algorithm works with faces made of rectangle, it should work with triangles for best results, but I think it would be far too complicated.

Results will vary from one model to another, the test model was particularly optimal (1760 faces to 92 faces), others are more complicated and can’t be optimized that much (1183 faces to 491 faces for the player model for example)


The tool is working quite well (takes a lot longer than before, but it doesn’t matter), I might make the source public at some point as I think it could help some people, but I need to clean it first (it’s really dirty).

New performance tests

I was secretly hoping to see a huge performance boost, but sadly it didn’t help that much. Of course if is better (~ 5 fps gain on Xperia ray, but still not playable) but not by that much…

But I tried something else…
In Alien Blitz:

  • Everything is updated at maximum 15hz (bullets, particles, monsters,…)
  • Bullets position is interpolated to be displayed smoothly at 30fps
  • Camera position is calculated at 30 fps

So I tried forcing the game to run @15fps, it means bullets are less smooth, the game becomes playable on the Xperia Ray, of course it’s not the best, but for mid-end phone it’s acceptable. So it could be a solution, but I don’t know how to determine when the game should be running @30 fps or 15fps. Frame skip could be a solution, but it works better to force 15 fps instead of checking whether or not a frame should be skipped.


Removing textures

Something else I wanted to try was to remove texture and use diffuse color instead. Process was fairly simple, I just had to change my qubicle to wavefront converter, convert all the current models and adapt the shader.

It didn’t change performance that much, it’s a bit slower when not using a texture (I guess because multiple meshes have to be used), but not really noticeable. Problem is there is a bug when using diffuse color, the last material color seems to be ignored. File is ok in wavefront, but once converted to g3d  the last color is missing, I don’t know if this is a bug with Libgdx, fbxconv, or in my converter, but as using diffuse colors is useless I will just revert to texture mode.



Comments are closed.