City generator - help with stopping buildings intersecting!

   4827   3   4
User Avatar
Member
319 posts
Joined:
Offline
Wasn't quite sure where to post this one, so thought ‘general’ would be best!

I'm doing an MA in Digtial Effects at Bournemouth uni and I am currently doing a group project to generate a medieval city for an hour long feature film shot by one of the uni lecturers.

What we hope to do is produce a ‘random city generator’ digital asset that will basically take a number of pre-modelled buildings and scatter them randomly over a designated area. I have tried to do a test and have come up with a very basic system using stamping and three low poly basic cubes of varying sizes. I have succeeded in scattering the buildings randomly over the area but I am having trouble with getting the buildings to ‘avoid’ each other, i.e. ensuring they don't intersect when the number of buildings are ramped up to show a heavily populated city.

I was thinking maybe you could use the ‘Compute nearest points’ parameter in the scatter SOP as this records the distance to the nearest next point and stores it in the ptarea attribute, but I'm not 100% sure how to ref this attribute and then how to actually use it to avoid the other buildings!

Can anybody help? HIP file attached…

Thankyou in advance for any tips….

Attachments:
City_Gen.zip (8.5 KB)

User Avatar
Member
13 posts
Joined: July 2005
Offline
Maybe you should have a look here :

http://odforce.net/forum/index.php?showtopic=3156&hl=city&st=24 [odforce.net]



Sven
User Avatar
Member
2199 posts
Joined: July 2005
Online
I imagine medieval cities weren't designed on the block system like NY. You could perhaps use nearest point to scale your blocks so that they don't intersect? or you could arrange your points so that none of them get too close, or combine both.

This thread should help a lot.
http://odforce.net/forum/index.php?showtopic=3600 [odforce.net]
The trick is finding just the right hammer for every screw
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
This comes down to a logic issue for me.

First I would try to inject as many attributes in to each building. I would use detail attributes for each building.
Some attributes of interest:

float area
float length > or vector lenght, widht,height
float width >
float height >
vector origin > fixed to say the SouthWest corner, BBox = 0,0,0 naturally
vector4 streetface ( S, W, N, E ) > 0 or 1 if entrance exists on the face.

I would also build all my buildings so that the main entrance was facing the South direction with auxiliary entrances on the other three cardinal faces.


Now build your city putting anchor points along the roads. This is assuming you are building a “real” city that requires at least one access road to a building face. :wink:

Use nearest neighbour in VEX to put in the distance between me and the nearest points.

Choose a selection of buildings that will “fit” from your inventory by parsing the detail attributes of the building set. Place building.

There are probably a few other approaches as well. This one gets you thinking in reverse. Not the buildings pushing each other around but what building will “fit”.
There's at least one school like the old school!
  • Quick Links