SceneCity has the capability to randomize the appearance of the objects in your cities. This is very useful to add a lot of visual variety in your city with a minimum amount of work.
Our eye is an expert at detecting things that are exactly similar. So if 2 buildings have the same mesh, with the exact same texture applied, we immediately notice that these 2 buildings are the same, and the level of realism of the picture suffers, since in real life, no two buildings are exactly the same.
Now introduce a bit a variety, like a different color, or a different texture, and the apparent similarity of the 2 buildings is greatly diminished, even if the mesh is the same.
In the picture above, there are only 8 very low-poly building meshes used. The roads are from the library.
Only 7 façade materials and 4 roof materials have been created. They are randomly distributed on the buildings when the city is built.
And this gives us this kind of city, in solid display mode.
Once we render it, the buildings all look pretty different. Notice that although the materials are randomly chosen, it is not done in a random way. Building façades display only building façade materials, and roofs only display roof materials. They are not mixed, and no other material in the scene has been used, for example the buildings don’t show the asphalt material used on the roads. Randomness doesn’t mean chaos, and you keep control on which materials are applied where.
Ideally of course, like in a real city, each building would be unique, with a unique mesh and unique materials. This is not a realistic option though: it would require too much work, too much computing resources, and would be a waste since the viewers won’t meticulously go building after building to check if they’re all unique. Artists must cheat to achieve their goals as quickly and efficiently as possible, and randomizing the materials is one way to cheat efficiently ;)
You have 3 ways to add randomness in your materials:
- the material used on a road portion or building in the city is chosen randomly from a pool of pre-made materials
- or the material stays the same all the time, but it has randomness built into it
- or mix both methods
Random material assignment¶
This feature works only for the buildings and roads made of a single mesh, not on those made of an object group. And it is also restricted to the individual objects placement method.
You can decide to apply a material on a specific part of the mesh of a building or road portion, randomly chosen from a pool of pre-made materials.
For that, you need to:
- create the pool of materials
- apply a material from that pool on the specific part of the building or road mesh
- create the city, time at which the final material will be chosen randomly
Create the pool of materials¶
Create your materials just as usual, make them as complex or simple as you need, and store them anyway you like (eg. on a dummy object, or using the “fake user” Blender feature, to avoid them being automatically deleted if they have no user in the blend file).
The required step to make any material part of a pool is by applying a label on it. A specific field for that can be accessed when you select the material in the properties view, in the SceneCity panel.
To make several materials part of the same pool, simply give them the same label. Note that the name of the material is totally irrelevant, you are free to name your materials anyway you like. For example in this picture, the selected materials all have the same label on them (façade), and thus are part of the same pool.
For more advanced needs, a material can have several labels, and therefore can be in several material pools. Simply separate the label names with a comma. Be careful with spaces, they will be taken as part of the label name, so don’t put spaces around the commas. If a material has several labels on it, and so is part of several pools, then a material will be chosen randomly from all of those pools.
For example in this picture, the selected material has 3 labels on it: façade, windows and dummy.
Labels are a way to describe a material, like tags on blog posts, so choose descriptive words to make it clearer for yourself later, in the next step.
Apply a material from a pool on a building or road mesh¶
This step is quick and simple: simply apply a material with the desired label(s) on a building or road mesh.
The randomization works per slot. If your mesh has several material slots, then you can safely apply a material which is part of a pool on a given slot, and only that specific slot will be assigned a random material.
Create the city¶
Finally mass-place the roads and buildings as usual, and the final objects will have a random material applied on the correct slots, and from the correct pools.
Materials with random features¶
This feature works per object, so it works for object groups as well, but is still restricted to the individual objects placement method.
Blender itself has some material randomization features. So instead of applying different materials randomly, another solution is to always keep the same material, but let it
- display random textures
- have different shades or colors
- show different parts of the texture
and it is even possible to mix both random material assignment with the materials also having random features.
At the heart of randomization in a material is the Object info node, with the Random output socket. It outputs a random number between 0 and 1, and this value is different per object. So if you apply the same material on 2 different objects, then both will have a different value for this socket.
Displaying random textures¶
Let’s see for example how the bus stops show different ads.
I will not explain how the node setup works exactly, as this is not a Blender tutorial, but broadly, the material has 20 different ad textures, that you can find and even modify in SceneCity’s folders. If you want to change the ad textures, make sure you keep the name of the files the same, at the same location, and the exact same number of textures. You should also use pictures of about the same aspect ratio, or they will appear distorted on the bus stops.
Then we decide which texture to use based on the value of the Random output socket. All textures have the same probability of being selected.
Do not hesitate to study the material and modify it if you need.
Having different shades or colors¶
Using the Random output socket in combination with the Brightness/Contrast node or the Hue/Saturation/Value node is a nice way to give each building a different shade or color.
Here is an example. First we divide the random value by two, so the output is no longer between 0 and 1, but 0 and 0.5, to make the effect not too strong. Then we subtract 0.25, to have a random value between -0.25 and 0.25, so that the texture can also be darker. In the end, our base texture can be between 25% darker and 25% lighter per object, giving more visual variety.
On four plane objects with an example texture, it gives
Showing different parts of a texture¶
If your texture is repeatable, and if exact UVs is not a requirement, then you can also randomize what part of a texture is shown on your buildings and roads.
This works by randomizing either the U or V coordinate. You can randomize both, but it is not necessary. In this picture, we add a value between 0 and 1 to the U coordinate.
On four plane objects with an example texture (not repeatable to better see the random U), it gives