To add the buildings to your city:
- generate the roads
- model the buildings or import the library
- choose which building models to use
- set the distribution textures
- mass-place them
Model the buildings or import the library¶
(If you’re just using the library of buildings, skip this step. See Import the default library)
Two types of Blender entities can be used as buildings: meshes, and groups of objects.
Just like the roads, the buildings will be placed in your city like Lego blocks, and must therefore fit together exactly to give an illusion of continuity. A few conventions must be followed for your buildings to be put correctly in the city.
Unlike the roads, the buildings can have different ground sizes, on the XY plane. So they occupy more or less area. Make sure the whole building model covers that precise area. Of course the actual shape of your building is still up to you.
- A building surface is always square, and is specified in increments of 10 meters on each side, so 10 Blender units: 10m X 10m, 20m X 20m, 30m X 30m….
- Therefore the bounding box of your buildings must stop at positive and negative size divided by two. Example: for a 30 X 30 building, its bounding box must stop exactly at -15 and +15 on both X and Y. Too small and there may be holes in your city between the building and its surroundings. Too large and the building may overlap with its surroundings.
- Local Z=0 is the ground level. Anything below the origin of the road model (negative Z in local space) is supposed to be under the ground, so will be hidden
- Don’t put the ground surface directly on local Z=0 but always slightly above. Otherwise the building’s ground surface will be exactly on the underlying ground, which is not possible in reality, and rendering artifacts will appear (Z fighting in technical terms).
- The front of the building must be on positive X
To easily add visual variety, you can have the materials chosen randomly on any part of your model, for each instance in the city, if you need. See the random materials.
Choose the building models to use¶
(If you’re just using the library of buildings, skip this step.)
You have your building models, but SceneCity doesn’t know about them yet. You have to tell if a mesh or object group is a building, and what size it is.
If your building is a mesh, select it, then look for the SceneCity panel, in the mesh settings. Check the box “Use this datablock as building”, and set its size (Surface side length). You can also choose the placement method.
If your building is an object group, do the same, except you first select any object part of the group, then look for the SceneCity panel, in the object settings this time.
The buildings will be chosen and placed randomly in the city. The “Relative probability to appear in city” parameter can be useful to control how rare or frequent a building appears. The default value is 1, meaning that all buildings with this value will be put in equal proportions in the city. If you want one to appear more often than the others, increase its relative probability. A value of 2 means it will appear twice as often as the other buildings with a value of 1. A value of 0.5 will make it twice as rare.
Larger buildings appear less often than smaller ones, so the land is occupied in equal proportions by buildings of all sizes. You can change this behavior in the general buildings options, see the step about mass-placing the buildings below.
If you imported the library of buildings, the included models will be used along with your own models. If you don’t want this, disable each building by unsetting their “Use datablock as building” checkbox in their object settings.
Set the distribution textures¶
This step is optional.
If you want to control where your buildings appear or not in your city, use distribution textures. Useful for creating districts, like for instance residential, commercial and industrial districts.
Imagine a map of the city seen from above, not in colors but in gray levels, where darker grays mean low probability of appearance of the buildings the texture is applied to, and lighter grays means high probability. That’s what a distribution texture is.
The texture is just a hint to the generator, not where the buildings it is applied to WILL actually be placed, as they must first satisfy other criteria, like being close to a road, on flat land, not underwater etc… But when a building is about to be placed, the distribution textures will be evaluated at that position, and this will affect the final choice of which buildings go where.
To set the distribution texture of a building, select it, go to the SceneCity panel in the mesh settings if the building’s a mesh, or in the object settings if the building’s an object group. In the dedicated text field, enter the name of a Blender Internal (BI) texture. If none exists, you must create one first. A green tick will appear next to the text field if a texture with that name exists.
Being a BI texture, a distribution texture benefits from the versatility of the node-based texture editor. It can be either image-based (eg one you drew), procedural (eg based on some noise function), or both mixed. It’s up to you how you make your texture.
Mass-place the buildings¶
Everything is ready for the generator now. You can tell it to mass-place the buildings for you. This is done by going to the general city settings panel, located in the scene settings.
You have 2 parameters here.
Amount of buildings (percent): this general setting lets you have more or less buildings in the whole city. 100% means you want your city to have as many buildings as possible. 50% means only half will be placed. 0% means no buildings at all will be placed.
Larger buildings appear less often (percent): normally larger buildings are less frequent than smaller ones. Change how much this rule applies to the city. 100% means full effect, and is the default. 0 means disabled, and all buildings will be considered equally, but then larger buildings may take a lot more space in the city, and appear more often.
A few notes about the generated objects:
- they’re always placed on layers 1 and 4 as well as on all the layers active at the time the objects were placed
- they will be children of the SceneCity buildings object, for easier 3d transformations in the scene
- they will also be part of the SceneCity and SceneCity buildings only groups. This is useful if you want to use Blender’s features related to groups, like selecting only certain groups, hiding/showing specific groups etc…