So, it's been a while since I posted. We ran into an interesting situation where we learned that Havok was exporting our referenced meshes as unique meshes within our level. This led to each mesh having its own unique vertex and index buffers. Now, with trees, paths, POIs, and other content, this led up to having 5600 unique vertex and index buffers.
That, for lack of any better words, is a lot of content. That's also a lot of state changes between graphics calls. So, how did we fix this?
Well, we first attempted to export our files using the Havok exporter in Maya 2011, using the "Find Mesh Instances" filter. This filter is supposed to remove duplicate meshes from the scene, but does not detail how it does so.
We at first assumed that any file that was referenced in would be considered a duplicate mesh. Then, when that didn't work, and we had a 50 MB level, we tried doing reference copies. That didn't work either. Well, I then systematically attempted to figure out how "Find Mesh Instances" worked. Turns out, I couldn't find a way for it to work (at least not using the filter).
But, after talking with Eric, I found a nice way around this.
So, the solution was instead to do this:
- Reference in the object / model you want to use from the file of your choice.
- After placing your reference, select the object in the Viewer or Outliner.
- Go to Edit->Duplicate Special (click the square next to it to set it up)
- Select Geometry Type as Instance and Group Under as World.
- Click Duplicate Special.
What this does is creates an instance of the reference that was loaded, which has its own transforms separate of its parent. However, because it is an instance of the reference, its materials, vertex data, etc will be changed when the reference is updated. Likewise, when you execute the shortcut now, these parameters will already be set up.
When you export using the Havok Content Tools exporter for Maya 2011, "Find Mesh Instances" will report not finding any duplicate meshes. However, only a single instance of the mesh will be loaded and referenced in the scene. For us, this insures we only create one index and vertex buffer per referenced mesh, greatly reducing the size of our level files and increasing run-time performance for the game.