Production Blog

UV madness

The current version of Kludge uses a procedure I call “unitizeAndPlace” which divides up the window UVs into an 8×8 grid on the 0-1 UV space.  It does this by iterating through all selected faces and assigning them to randomly-selected spots.

This is very slow.  On a building with ten thousand windows, the uAP script has to run a loop to select the face, pick a random number, and move the UV shell ten thousand timesUsually this takes a few minutes, but the larger the number of faces, the larger the performance hit.  A massive building with 60,000 windows will take more than an hour to UV.

The result of all this is that 1/64th of all the faces end up on each of the 64 possible UV grid spaces — which means there is a much better way to do this.  Instead of randomly placing 10,000 faces, instead, I’m now creating 64 groups of random faces and assigning them to each of the 64 spaces.  The randomization and selection process still takes some time, but I’m also using sets instead of arrays for the face lists, which should reduce the amount of time required writing and re-writing arrays.

I’ll post up the results whenever I run some stress tests.  I think this script could be useful for a variety of projects, not just Kludge.

Advertisements

One response

  1. Rob

    The link for your Kludge City documentation is broken.

    June 19, 2011 at 10:52 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s