A city of random cubes
Create a new city graph, and name it My new city for instance.
Add the following nodes to the graph:
Meshes ==> Procedural cube mesh
City layouts ==> Simple buildings layout
Objects ==> Mesh data to Blender mesh and object
(In Blender, to add a node, hover your mouse over the node editor area, and press SHIFT + A (A as in Add) or use the Add menu, in the editor’s header. )
Connect them like in the image below, set the noise subtype to Cells, then click on the Create / update mesh and object button. In the 3d view you’ll see a city appear, select it and scale it down 100 times (scale 0.01).
Let’s see how that works. The central node is the most important one: the layout. A layout in SceneCity is a method to mass-place buildings, roads etc… Anything that makes a city. You’re using the simple layout, this one places buildings only, and randomly without checking for overlap. On its left is a procedural cube. You’re feeding the layout with a procedural cube for its Buildings mesh data input. As a result, everytime the layout needs a building, it asks the procedural cube mesh node to give a cube as mesh data, with the desired size, and adds that mesh to the final city mesh. Finally on the right, you’ve added a node that can convert SceneCity’s mesh data to a Blender mesh and a Blender object in the current scene and active collection.
When you want to know more about any particular node, simply click on the Node doc button, it is a direct link and will open its doc page in your web browser, so do not hesitate.
To see the button, select the node, and open the N-panel, in the node editor.
Make the city layout more interesting
Right now the layout creates the buildings in a very homogeneous way. You can change its parameters, but in the end, all the buildings look more or less the same. So let’s fix that.
A layout can be controlled in space. That means that you can tell it where you want things to be different. The simple layout can be told where we want tall and small buildings. And where we want no buildings at all.
Add the following nodes to the graph:
Maps ==> Procedural map
Maps ==> Map to Blender image
Connect them like in the image below, then click on the Draw map in image button. In the UV/Image editor panel, select the newly created image to see it.
With those two nodes, you’ve created and visualized a map. A map is a 2d area of values. It is continuous, which means unlike an image it is not a raster (or an array), and can have an infinite amount of details. This is exactly what the procedural map node is for, it creates a map based on a procedural noise function. In this example you did set the cells noise. The second node draws a map into a Blender image.
Let’s use the map, connect it like below, and re-create the city.
Now your city has a lot more interesting patterns. Notice that where the map is black there are no buildings, and that lower / darker values produce smaller buildings.
Add textures to the buildings
Our buildings are boring to look at, let’s give them some colors.
First, we need to be able to apply different materials to the facades and to the roofs of the buildings. Set the procedural cube parameters like below, then re-create the city. Verify you have two material slots for the city mesh.
What you just did is:
scale down the size of the UVs for each face of the cubes, this will increase the size of our facade texture displayed on the buildings in the next steps
set the UV unwrap mode to the one most random-looking
enabled random UV translation to diminish visual-repetition
set the material slot index to 1 for the top and bottom faces of the cubes
Secondly, let’s create the facade textures. Add the following nodes, connect them like below, and click the Create / update images button:
Textures and images ===> New texture set
Textures and images ===> Random rectangles drawer
Textures and images ===> Simple windows drawer
Textures and images ===> Texture set to Blender images
Now you have in place a mini-pipeline of drawing functions. The first node creates a new blank texture set, which is a collection of textures for a PBR material. Then you draw random rectangles in the albedo channel of the texture set, to add some interesting patterns. Then on top of it, you draw facade windows in both the albedo channel for the unlit windows, and the emit channel for the lit windows. Again on top of both you draw the same rectangles, in the albedo and emit channels, with the rectangles totally black for the emit channel to block the lit windows underneath. That breaks the repetitiveness of the facade windows and their monotony by adding interesting patterns. Finally you output all the channels into Blender images, so they can be used in materials, and saved as image files.
Let’s create the material now:
You can turn on the emit channel for night shots, and off for daytime. With a bit of work you can make the materials more elaborate to increase realism, like adding detail textures, make the windows reflective etc…
Use your own buildings and combine layouts
Using random cubes is great to quickly have buildings, but their shape remains very simple. Let’s add our own buildings, made by hand so we can have them a bit more complex. They can only be single meshes. Let's use this low-poly building for example:
Create or get a building of your own (as a single mesh), take note of its name (the name of the mesh), and its size. Then in the city graph add two new nodes, plug them like below, and adjust their settings:
Another simple layout node
Meshes ===> Blender mesh to mesh data
What you did is create a new layout, and chain it after the first layout using the Previous mesh data input socket. That means that when the second layout does its job, it appends its result (in the form of mesh data) to the result of the first layout. Moreover the second layout takes its building mesh data from another node, which itself converts a Blender mesh, in that case our custom building mesh, to mesh data.
The new layout has been adjusted to scale our building according to the scale at which it has been modeled. The example building mesh is 1/10 of its real size, if one Blender unit equals one meter. So it must be scaled up about 10 times in the final city mesh, to be consistent with the previous buildings cubes. In the example I set the layout parameters a bit larger (20 and 30 for XY size mult and Y size mult) on purpose. I also turned on random rotations for each building instance.
Re-create the city (it will take a bit longer, especially if your custom building is high-poly, so watch the console), and you should now have two different buildings mixed in the same city mesh.
What would be a city without roads! We’ll add simple ones. They consist of a road portion mesh repeated along several curves using Blender modifiers. The curves will loop, and never branch, so there won’t be any crossing. They don’t test for intersections either. But they will look intricate nonetheless, and will give a very nice result for distant- or middle views.
First you need a mesh of a road portion
This model is available in the pre-made assets. You can import it as explained in the fundamentals. Look into the collection SceneCity low-poly assets.
Due to the way the curve and array modifiers work, it is not possible to scale the objects following the curves without having them not be repeated enough times (or too many times if scaling up) to cover the full length of their curves. Therefore, it is important to have your road portion mesh be modeled at the exact scale as the final scale (so model it with its object scale = one). In that particular example, since my city is scaled down 100 times, I model this road portion directly at the scale of 1/100. Inconvenient, but there’s no way around it that I know.
Now add 4 new nodes, and connect them like below:
Curves & paths ===> Path generator
Curves & paths ===> Paths to curves
Curves & paths ===> Curves to Blender objects
Curves & paths ===> Blender objects repeated along curves
Set the mesh portion on the last node, then click the create buttons on both last nodes. This should give you this kind of result
When your scene starts to be cluttered with many objects created by SceneCity, remember that all create operations create the new objects in the active collections, so you should put the roads and buildings in different collections for easier scene organisation. In addition, don’t forget to tell SceneCity to name the generated objects correctly, as this will make your job much easier. AND the delete operations (such as those on the last two node) find the objects to delete based on their name.
Congratulations! You should have a good understanding of the way scatter cities works. You can now play with the settings, combine more layouts and buildings, build larger scenes, and you don’t have to stop with SceneCity. It’s there to help, but doesn’t stop you from editing the city by hand. You can add the city onto a terrain, add lights and lit billboards for night scenes, go crazy with very tall buildings sci-fi style, or export it to other software for rendering.
The great thing about nodes is that you can use and combine them anyway you like. In this page you’ve learnt the main nodes and their most obvious uses. But there are more nodes (and therefore more features), and each have many options. So you should start experimenting and playing with nodes, change their options, try new ones.
Here is an idea: why not animate cars along the roads using their curves, and render an animation.