Freigeben über


Let's blow up the exporter real good!

I first came across our vertex limit issue when trying to debug the export of the trike model.  For some reason when we tried to export the Aircreation, it would continously throw up errors about exceeding the max vertex limit.  Huh?  We'd never run into this problem before.  Why were we suddenly seeing this?

Well, in our quest to up the ante in terms of visual quality, we ended up creating a model that exceeded the 65,000 vertex limit for a single draw call.  "But it's only got 27,000 polygons and 15,000 vertices!" we thought to ourselves.  What we didn't realize at the time was that a) Non-perfect UV mapping and smoothing can convert single vertices in 3ds Max or Gmax into many vertices on the graphics card and b) in the quest to reduce draw calls, we had actually run into one big draw call.   Too big, in fact.

So lets look at issue a).   At first blush, the polygon and vertex count should not be an issue at all.  One of our vertex buffers can hold roughly 65,000 vertices.  The trike should easily fit into one of those.  However, as we started to look at the UV mapping and smoothing, we realized that we were indeed exceeding the limit after processing.  Everywhere there is a seam in the UV map, those vertices get doubled on the graphics card.  If it is the corner of a seam, they get tripled or more.  The way this particular model was UVed, it had very unique seams around most of the geometry.  This resulted in a whole bunch of the vertices being doubled or tripled.  So now our vertex count was around 30,000.  Additionally, every vertex that is on the edge of two smoothing groups also has to get doubled, tripled if it is one the edge of 3 smoothing groups.  And not all of the UV seams lined up with smoothing seams.  Suddenly our vertex counts were upwards of 40,000 to 50,000.  Oh, and we also had a bug where objects with normal maps were passing double the vertex counts.  Oops, now we had exceeded the 65,000 vertex buffer. 

Which brings us to issue b).   In our quest to reduce draw calls we had created a single texture sheet for the Aircreation.  So now the entire model was being fitted into a single vertex buffer, which it couldn't fit into.

So how did we solve the problem?  Well, once we animated some parts, that broke up the draw calls.  Also, once we applied some different materials with different parameters, that also broke up the draw calls.  So if you're trying to export a model with 100,000 polygons and you are running into the vertex limit, first of all, shame on you.  ; )  But I know, it's fun to push the limits, so after getting over the initial shame, if you want to load huge models into Flightsim, you'll have to make sure that they are broken up into consumable chunks.  So even if you want the same texture and material, you may have to create a second material and change specular power to be 56 instead of 55 (or something minimal like that) and apply it to half of your gigantic model.  Then it will export as two draw calls and fill two vertex buffers.

So now you ask "Why didn't you automatically break up huge objects along vertex buffer seams so we don't have to do this hack?"  Well, unfortunately it was one of those things we just didn't get to.  And I'm sure you'd rather have a new sim engine or graphics feature than an exporter feature that has a simple work-around, right?

Comments

  • Anonymous
    January 01, 2003
    Thanks for that explanation Adrian. That is very useful information and certainly explains why I obtained different results on separate occasions when testing vertex limits. Nice to see you return to blogging too. :)

  • Anonymous
    January 25, 2008
    Interesting post, reminds me of work, when we try to optimize stuff... Thanks for sharing :)