Thursday, June 20, 2013

Robustness

Now I have some geometry that better represents what might actually be used in practice.  How well does it work?  Pretty well on any given side of a building, not so well at the corners.  Remember that the grammar builds each wall separately and (in a horizontal layout) keeps adding floors until the total height of that wall is greater than the height from the input file.  The problem is these new elements are not uniform height (or even integer).  One wall might get a floor that is only short decorative items and another might get several floors with some really tall element. the trouble is one might barely cross the threshold and the other might shoot way past it.
Oops.  
This is another problem, buildings generally have the same number of floors on each side.  Easy enough to just trim off the extra floors on any wall that got too tall, but what about uneven floor heights?  

There are a number of easy, direct solutions.  I could just clamp everything to the average floor height, that wouldn't be too bad.  Simulated annealing might have a better option though.  For each level (equivalent floors on all sides) match the heights of the floors on one of the floors already there.  Its about the same as picking one side and matching all the others to it, but with more possible combinations.  The point of simulated annealing is to optimize something, so lets minimize cost.  Most elements are designed to look a certain way, stitching or squashing them make them look wrong.  So measuring deformation per-element is a good place to start for cost.

On loading each element I can store its aspect ratio and measure the normalized change from that ration after the element has been altered.  It might make sense at this point to exclude the fill element used to take up whatever slack is left at the ends of each floor so that corners match.  These elements are supposed to be so simple that some scaling is not noticeable.  Regardless, the sum of the normalized distortion of all the elements gives a cost for the building.  With a little more experimenting and some hard coded exclusions of situations I know cause problems I got some good looking buildings out of each run.


Monday, May 20, 2013

Big Changes

Catch up time.  I have modeled a more complex and varied set of elements to test some more subtle features.  Obviously not every building is make of perfect 1 by 1 squares.  When introducing this new element set there were some interesting bugs.  These elements are based of this building:

The first run at arranging them revealed an interesting problem: the elements are not all the same height.  The result is actually very helpful for showing how the elements are distributed, but is lacking in realism.  Mostly due to the giant holes in the walls.

Fixing it was easy enough, I already have great tools for scaling.  For now the simple approach of scaling everything to match the tallest elements in each floor fills in the holes.  A more elegant approach is definitely possible, but we'll get to that later.  Once this is fixed up the results look pretty good:

Friday, March 22, 2013

Roofing

Adding roof tiles and extending the buildings to arbitrary footprint polygons were not well planned for features from from the beginning but their addition was an excellent excuse to clean up some of the older code.  After some reworking of the code to make them function.  In the grammar 'r' is now a reserved symbol that indicates the grammar to be used for the roof.  In the general section there is a "footprint" line that overrides width by having each side of the polygon listed after.
This results from:

r ty
   y ty
and
footprint 0,0 14,-5 10,0 10,-10 0,-10

The protruding features of the roof  the break plane (cornice and slope) are neatly adjusted at the corners to avoid messy overlap.  Overall the output looks much more like buildings now

Friday, February 8, 2013

New Geometry

Today is a simple update, new geometry to try and make more realistic buildings.  These are supposed resemble some of the curved elements from the previous post.

Saturday, February 2, 2013

Rowhouse Refference

After going for a few walks around town I have collected a few reference photos of the general layouts and elements of the buildings I am trying to create.
Simple symmetry

Bay windows and a decorative roofline

Very distinct floor seperation

Offset between adjacent buildings

Homogeneous style between door and windows

A centered door (rare)

Unusual buildings in pairs

Really great windows (a personal favorite)


Wednesday, January 23, 2013

Took a bit of a break.

Simulated annealing is having some issues geometrically determining an elements neighbors.  In the mean time I have cleaned up the grammar implementation to handle non-terminal symbols in the middle of a string.  This has allowed me to create symmetric grammars and building.

grammar:
s gh
g bdf
f bbwf

h bob
h wow
o bzozb
o bxoxb
end

Rendered out in ambient occlusion: