Building Buildings

I've been working on my King of Tokyo proxy models for a while now, which has meant that I've needed a bunch of buildings to put onto the bases for the various Kaiju to rampage through.  Rather than building each of these buildings by hand, I put together a system of arrays to do it for me.  Since I'm rather proud of how it all comes together, I figure that I should go ahead and write about it here!

So, let's talk about how it all works.  First, here's the meat of the "city building" collection that I use (for those of you on the Patreon, that's the actual name of the collection where I keep all of this stuff in my King of Tokyo files, if you want to look at it in Blender).  As you can see, there are several partial buildings there, as well as some random bits on the right.  It's a bit harder to see, but directly in front of the left-most building, there are three bezier curves (although each is a straight line), running parallel to the world axes.

Those bezier curves are my controls.  By adjusting each one's length, I can quickly control the height, width, or depth of the building that I'm generating via the arrays.  As you can see in this screenshot, each of those partial buildings is also adjusted to match the lengths of the lines, which is how they all get put together to make the final building.  I do have to merge duplicate vertices on the final product and use a grid-fill for the top and the bottom of the building, but that's really easy all things considered!  So, let's look at what all is happening here.

I started out by modeling one window section from a building.  I knew that this window section was going to need to tile to create an enclosed building, so I left the edges open, ensuring that the left & right edges were mirrored (I actually designed it with the Mirror modifier on, which is why there's that central edge).  I then had to do the same with the top & bottom, which I just did by hand.  After I had my window section built, it was time to set up the Array modifiers.

Alright, these guys are pretty complex and they took me a lot of trial and error to figure out.  You'll see that I'm using 2 Array modifiers here, named Tall and Long.  At their core, they work the same way.  Notice that the Fit Type for each of them is set to Fit Curve, and I've selected the appropriate "axial line" curve object for each of them.  That's the essence of how I got these buildings to scale so dynamically based on the lengths of those curves!

So, those two Array modifiers will cleanly generate one face of the building, but you may have noticed that the Long array has an additional setting: the Start Cap.  The Start Cap & End Cap on an Array modifier is really cool; it's basically just another object to throw on the beginning and/or end of the array.  In this case, my arrays give me an excellent front face to the building, but they don't handle the ledge corners that jut out.  That's what my Start Cap does!  This bit of geometry looks super boring, but it's just the extra little bit that needs to get prepended to each window section to allow the next one to join it at a 90 degree angle.  I used the same Fit Curve trick here as I did on the main window section, so as I increase the number of floors being generated on the windows, I will also increase the number of corner sections to match!

So, how did I get that next wall to wrap onto that corner?  End Caps!  Here's a screenshot of the 2nd building from the right, the one with two faces complete.  Notice that it has the same Tall & Long array modifiers on it and that the Long one also uses some Corners as the Start Cap (I had to make a custom set of corners for each face, with those corners placed and angled correctly to line up with its appropriate wall section).  The End Cap is where it gets fun though; I set it to the original Wall section that we looked at first, which basically throws that wall onto the end of this new wall.

Well, at this point, you can do the math... I basically just repeated that process for each face of the building, using the prior one as the End Cap each time until I had all 4 faces put together!  Each successive End Cap added one additional face to the building, while maintaining my dynamic sizing as controlled by the arrays' Fit Curve object settings!  I just had to be very careful when setting up each wall to ensure that it was fitting the right curve, although mistakes were pretty obvious pretty quickly ;)


So, once I had a 4-faced building, I had to make it a water-tight mesh for 3D printing.  The first step to that was to apply my modifiers, so I hit Shift-D to duplicate my building (and dragged it off to the side a bit), then pressed F3 and searched for convert to mesh, then hit that when it came up.  Once it was a plain Mesh, I selected everything (by pressing A) and then merged all of the vertices by distance (by pressing Alt-M and selecting By Distance).  This turned my 4 building faces into a single object, making a sort of building tube.


With my "building tube" put together, the final step was to put on a top and a bottom.  Fortunately, this is super simple.  Just Alt-Click one of the edges on the top, then go to Face and select Grid Fill (I use this function enough that I bound it to the Shift-F shortcut).  Once the top is done, just repeat the same process on the bottom!

I like to use a Grid Fill instead of a normal Fill because it will make a series of rectangles, instead of one giant n-gon.  When I later take the building into sculpt mode to put some battle damage on it (after all, this thing is going to be in close proximity to a Kaiju!), that dyntopo sculpting experience will go much better if the top & bottom are a bunch of quads instead of one big n-gon!

Comments

Popular posts from this blog

How Much Filament Do I Have Left

Prusa MK3 Stringing at .05 mm Layer Height Resolved!

Using PrusaSlicer to Design Tree Supports for FDM Prints