I'm currently constructing a city in blender, and one thing that I would like to do, so as to avoid modelling hundreds of buildings by hand, is to randomize some elements of the buildings. What I was thinking is using a combination of duplifaces and scripted empties.

What I want to do with the empties, is I want to script them so that they will take the form of a random mesh (through dupligroups), which is selected from a list. For example, have an empty that is meant for a window, randomly select from a set of window meshes, and it takes the appearance of the selected window. The empty is parented to a mesh that has Duplication Faces enabled, so a copy of that empty's assigned object appears on each face.

I am familiar with Python, but I am not familiar with blender's python API. So, what I need to know boils down to this:

On an empty that uses Duplication Group, is there a way to change the group by Python script or other means? And further, can it be done in such a way that each instance of that object has a different group assigned? IE: If I copy a building that used random windows several times, each building would have a different window type instead of the same (randomly selected) window type.

EDIT 1: I have attempted to implement this (unscripted) through the use of a particle system, with the particles set to randomly select an object from a group. However, this did not work. The way it randomly determines the selection is such that it will always have the same result every time. I realize there is good reason for this, but unfortunately it makes it not so useful in my case, as it causes it to always select the same object, no matter what.

EDIT 2: I have figured out how to change the random seed for a particle system, which does change which object is randomly selected. And I have figured out how to set up a driver that uses the parent object's position to change the seed. The particle emitter and its parent object are placed into their own group, which is then duplicated by several empties. However, instead of each empty having a different object, they are all carbon copies of the object they are duplicating.

Blend file I was using to test stuff in the above two edits: http://www.pasteall.org/blend/40062

  • $\begingroup$ It isn't uncommon to model a few buildings then use particles to distribute some of each throughout your city. Blenderguru has one of the tutorials on it. $\endgroup$
    – sambler
    Jan 10, 2016 at 16:07
  • $\begingroup$ somehow related: blender.stackexchange.com/questions/8545/… $\endgroup$
    – user1853
    Jan 10, 2016 at 19:48
  • $\begingroup$ @cegaton: Yeah, I've seen suicidator. AFAIK, it only generates modern cities. I'm trying to create a canal city within a time period equivalent to the late 1800's and early 1900's. $\endgroup$ Jan 10, 2016 at 20:25


You must log in to answer this question.

Browse other questions tagged .