Complex geometry - Intro II.

Drawn template - Highway - Finalization of the scene

In the previous Complex geometry - Intro I. tutorial, we worked out an example of an urban scenery. Now we will return to it and finish it by adding the above-ground highway and making some adjustments.

Drawn template

To produce the highway model, we'll introduce another Complex geometry function - the Drawn template. It is a function that creates a model by drawing of one or more pre-prepared profiles along the specified trajectory. It assumes that both profiles and trajectories are just models built by edges, with no faces.

First, we create a highway profile. To do that just use the Line model on the 2D bodies tab on the left panel. Select it and press Create button. In our example, the body of the highway has a hexagonal profile, so set the line with 6 segments. Select the option Model - Convert to general geometry or Ctrl + G shortcut to convert the line to General geometry and adjust the vertices to a shape similar to that seen on the picture. On the scale of our city, the entire profile should have the dimensions X Y Z = (3;0.5;0), which is needed to check by the positions of the individual vertices. Note: The first and last vertex will be matched, not merged. This is because the Drawn template also generates UV mapping of the vertices of the resulting body, and if the profile does not have independent vertices in its outline, the drawn template would be generated wrong.

We still need to prepare the second input component, the trajectory, according to which the profile / template will be drawn out. For this tutorial, we only need to use the Bézier curve as a trajectory. On the left panel on the 2D bodies tab select Bézier curve and press the Create button again. To fit our scene, set it as follows:

  • Width: -50
  • Length: 100
  • Angle 1: -90
  • Magnitude 1: 50
  • Angle 2: -90
  • Magnitude 2: 50
  • Segments: 20

We can now produce the Drawn template. On the left panel, navigate to the Complex geometry tab selecting the Drawn template and press the Create button. Its settings are quite easy. For the parameter Trajectory press the [...] button to select the trajectory model, Bézier curve from the list. Next for the parameter Template press the [...] button again and select the highway profile from the list. And that's all, Drawn template has been produced.

Tip: It may happen that the Drawn template is made with the faces inverted inwards. It is enough just to convert to General geometry, select all faces in the faces editing tab and change their orientation using the Flip button.

In our case we have made the Drawn template of course much easier, but in fact, this feature can do even more. Note that the Template parameter is not a text field, but a drop-down. This means that we can gradually insert multiple templates / profiles and the list of which is displayed in this drop-down menu. With the Trajectory vertex no. parameter we can then place the currently selected template at a specific trajectory vertex, so the Drawn template can then vary the shape of its profile. Below is the section Template transformations where we can adjust setings of the current template, for example with a different rotation etc., which will again appear in the appearance of the resulting Drawn template body.


However, the Drawn template does not yet make the highway, so you need to edit it by following these steps. In the first step, we produce and assign the highway material. On the toolbar open the Materials palette and in one of them that is empty press the Diffuse button under a row of gray frames. The window for diffusion texture settings opens, where you click Open... button, locate the Highway_01.png texture and then close this window again. Just like the other materials we have created here, this one will also have the character of concrete, so we can set it as well:

  • Diffuse texture: Highway_01.png
  • Specular exponent: 5
  • Specular component (double click on color square): 64;64;64
  • Other values: default

After setting assign the material to the Drawn template by the Add button. Next, we can see that after creating the Drawn template has all edges smoothed. Since the street and bottom surface of the highway body are to form a plane, it is necessary to break their border edges. To do this we convert the model to General geometry by pressing Ctrl + G shortcut. One way to break the desired edges is to switch the viewport view to one of the sideviews. Then on the faces edit tab select all side faces of the Drawn template. Selecting the side faces because the highway lies flat and this can be done in a single drag while looking from the top the highway is curved and selecting would be more complicated. Be careful not to select top and bottom faces when marking sideways. When you have a selection, click Revert and then Flip. With the Revert button, the orientation of the faces has been overturned with their current cut off from the other - edge breaking. By pressing Flip, we have only changed the orientation of these faces back to the original ones.

In the third step, you need to adjust the UV mapping of the texture on the surface of the highway model. Make sure you have selected the model of the highway and open the texture mapping window either by selecting Model - Texture mapping... or by pressing Ctrl + Shift + M shortcut. Then move the vertices in the UV space so that they are distributed along the texture accordingly (street upward) as well as you move the vertices in 3D space. As long as the texture covers only a short segment of the highway, then select all vertices and with help of the Scale transformation in Texture mapping window spread them several times along the V axis.

Finally, the highway is missing supporting pillars, which we create by the already-known Generated set. First create a Cylinder from the 3D bodies tab on the left panel:

  • Radius: 0.250
  • Height: 5
  • Taper: 0
  • Radius Seg: 1
  • Height Seg: 1
  • Round Seg: 8
  • Cutting angle: 360

Apply the highway material on this cylinder and use the Texture mapping to modify it to cover only part of the concrete texture. We need the target surface for these cylinders / pillars to distribute them on it through the Generated set. This will be the bottom surface of the highway model. Select the highway, go to the faces edit tab and select the bottom surface. Here we need to isolate it to make it clear that the pillars will not be deployed elsewhere, so on the faces editing tab, press the Duplicate button and then click the Detach model button on the element editing tab. So we copied the bottom of the highway and created a separate model of it.

Now, on the Complex geometry tab, select Generated set and press Create button. Separate model of the highway's bottom insert as a Model of normals and as the Model of heights too and as a Element model insert the Cylinder constructed a moment ago. The bottom of the highway has a suitable density of segments so that by placing the pillar at each its vertex a naturally-looking support of the whole highway is created. How many vertices do we have in the bottom of the highway we will find out, either at the top of the vertices edit tab when selecting all vertices or from the model properties (Model - Model properties... or Ctrl + P). But we know that in this case there are 42 so Elements count = 42 in the Generated Set.

You probably see the pillars penetrating the highway. We will fix it easily. Select a cylinder model, switch to the vertices edit tab, where you select all vertices and move them down by Z - 2.3. Set the cylinder as an Element model into the Generated set again. In this way, the pillars will be only partially embedded in the highway's body and the rest will reach the surface of the terrain. Now you can place the model of the highway and pillars on the desired place in the scene.

Finalization of the scene

Now the scene should be very close to the picture. In the end, we still need to get rid of all the help models we made during the work. Caution: The Complex geometry works with references on input models. If we delete them now, then the Complex geometry that is bound to them will lose its shape at the first reset. First it is necessary to convert to general geometry all the models of complex geometry by option Model - Convert to general geometry or by Ctrl + G shortcut. Only when you have all the Complex geometries converted to General geometry you can delete the other sub models.

Secondly, we created skyscrapers, residential buildings, and highways over the same locations in the construction of urban scenery. So choose a model of a generated set of residential houses and, if you have not converted it to General geometry, do so. Then, switch one viewport to the Top view using the drop down menu in the upper left corner's arrow and in the same menu select Edges from the Render category to see the overlapping of all models. Now switch, for example to the faces edit tab and in this view select the faces of all the residential houses that lie on the site of the skyscrapers and delete them. Also completely delete the residential houses that lie in the highway.

The city is ready.

<< Return to topics

Copyright (c) 2013 - 2023

General terms and conditions

End user license agreement