Sunday, January 20, 2013

OgreMax exports too many vertices!

OgreMax is the preferred Ogre mesh file exporter for both Maya and 3DS Max.

The problem is, it is exporting around 4x the required vertex count! Note this problem affects both versions of the plugin (Maya & 3DS Max)

Geoff asked us to look at the corn field because it was having a terrible framerate. I took a look with Jeff, the modeler responsible of it, and it wasn't exactly the most expensive model ever invented, to be generating such slowdown.

So, I took a deeper look with Ogre Meshy, and the vertex count (around 1100) seemed too high to be true. Even more suspicious was that the vertex count was exactly the index count.
I ask Jeff to handle me the obj file so I could export it in Blender. And the resulting vertex count went down to 442!!! I thought it could be a problem with the smoothing groups, as flat shading causes a lot more vertices to be generated (vertices with different normals need to be duplicated).

I reexported with flat shading this time, vertex count was now around 700, still lower than the exported mesh from OgreMax!

As we played with OgreMax settings, we found out the culprit is a setting named “REMOVE DUPLICATED VERTICESwhich is turned off by default!!
After re-exporting with this option on, OgreMax' exported model matched the vertex count from Blender (442)

This is very bad, because not only the amount of vertices is increased, but it's also the worst possible scenario: Every vertex is not being shared and thus can't be reused. This leaves the post vertex cache completely useless. I don't know why the default option is left unchecked, I can only think of very few possible scenarios where having 1:1 vertex - index ratio could be useful.

We proceeded to reexport all of our assets in, most important big ones first. The zombie vertex count went down 4.1x.

Thanks to our buddy Jeff who took the screenshts for us:



No comments:

Post a Comment