Production Blog

Some people program. I Kludge.

KludgeCity is a building and cityscape generator being developed as part of my short film project, "The Sum of Parts". It is open-source and freely available for anyone to use or edit. You can download it here.

Latest

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.

Delays, but…

Hey, if anyone wants me to email them a copy of kludge 2, bugs and all, just let me know. The project is officially “on-hiatus” while I finish up a couple projects this summer.

Version 2.0 Delayed… again…

I’ve recently started a job with a studio here in Dallas, so I haven’t been able to do ANYTHING with Kludge for a couple of months.  I still need to fix a handful of hiccups with Maya 2010 not working correctly, but more importantly, I’ve actually come up with a few really good ideas that I want to incorporate before I release version 2.  I appreciate everyone’s patience… the end result should be a streamlined, production-friendly tool that actually works as advertised.  In the meantime, check out the progress on http://sumofparts.wordpress.com — the short film that Kludge is ostensibly built for.  We’re actually making assets!  hooray!

By the way, if any of you are using Kludge to do anything interesting, send me a picture!

Demonstrable

My 2010 Demo Reel has an example of KludgeCity in action:

 

The reel can be found here: http://vimeo.com/17833535

A Long Way Down

As part of a test, I ended up building a 200-story, fully-loaded KludgeCity building.  It tips the scales at 1,800,000 triangles including exterior details and interior geometry.  The actual building took about three minutes to generate without UVs.  I included balconies, but I somehow doubt you’d want those on a building this size.

big building test 1

big building test 1

Window Treatments

Finished the first step of the UV workflow — the “unitize and randomize UV” script from the first KludgeCity.  Now all buildings have their windows and interior dividers UV’d based on a random 8 by 8 grid.  Also, I’ve added a “color” rollout that allows you to define what colors you want to have on your building shaders before they’re generated.  This allows you to set a refraction/reflection tint for windows, and also lets you create a “variation grid” that controls a random value shift on the glass color.  Below is an example of the window variation, and with nightscape workflow enabled.  Starting to see the light at the end of the tunnel on version 0.2, but I’ve still got a lot of elbow grease to put in.

shaders rollout

shaders rollout

uv windows

uv windows

uv windows with nightscape

uv windows with nightscape

Fresh air for KludgeCity Residents

working on balconies.  Not exactly realistic right now, but I’m trying a couple different variations.

balconies experiment

balconies experiment

A note on process

In case anyone’s curious, I thought I’d let you know sort of what my process is when I’m working on Kludge.

Most importantly, I keep my eyes open when I’m out and about.  I live in Dallas, so we’ve got a fairly decent variety in our skyline.  I take photos when I can, and look at pictures of interesting buildings online. There is sort of a vocabulary of city architecture — some buildings have alternating stripes of material (what I call “buffers” in the script), some buildings have windows that wrap around, some have blank walls without windows, some are monolithic and flat on their facades, and others have all kinds of details extruding out from their surfaces.  My job is to take those basic architectural ideas, and make a system that is capable of creating them on the fly, for any mixture of features.

It doesn’t always work.

The first step is always to model out the structure by hand.  Everything you do in Maya has a corresponding command in MEL.  In theory, if you can do it manually, you can do it in a script.  I’ll work out a list of steps that are involved in creating a particular bit of geometry, and write out a sort of “pseudo-code” that summarizes the process.  Then I figure out what MEL commands will give me the desired result.  Usually this involves a lot of guess-and-check and many trips to the technical documentation.  MEL is good at a lot of things, but it can be incredibly difficult to find a scripted solution that mimics human creative judgment. “select the faces that are facing outward from the building” is great if you’re talking to a modeler, but translating that into code can be tricky.

At the core of Kludge there is the default building — the only building that is guaranteed to work perfectly every time.  Whenever I add a new feature, I work with this default building at default settings until I make it work correctly.  The “ideal test case” is something I come back to throughout the testing process — every time I make a major change, the first thing I check is to see whether the default setup still works as expected.

After that, I try out a handful of other configurations.  If all goes well, then I proceed to do everything I can to break the system.  Most of the time, this is not difficult.  Usually, I try to “user-proof” the system to the best of my imagination, but the truth is, there are more ways to break Kludge than there is time for me to fix them.  All I can really do is try to make the system as flexible as possible.

A lot of the functionality of Kludge will eventually involve randomization, and I really can’t ensure that every combination of features will look good, or even work at all.  But I guess that’s really the power of working procedurally — if you don’t like the result, in a couple minutes, you can have an entirely different building.  There’s no reason not to try a bunch of different things and only keep what works.

 

Wait, what’s this?

Is it possibly the nightscape workflow that I promised but never delivered on in the first version?  I think it might be.  Still leagues from perfect, but so far so good!

nightscape test 01

nightscape test 01

Approximately Proxy

Added new feature — now you can generate a low poly proxy (152 quads, compared to 70,000 for the full mesh)

You will eventually be able to toggle between the visibility of the proxy and the high-poly version, so you can place your buildings before render time, add a command as a pre-render MEL script, and the system will switch all of them out for the render.

proxy example

proxy example

proxy example wireframe

proxy example wireframe

Follow

Get every new post delivered to your Inbox.