This tutorial will deal with the construction of intersections. In the following, the different methods are briefly explained and a small insight is given by means of an example. The method shown is not intended to be a best-practice guideline, nor does it claim to be universally valid for all types of intersections.
In this tutorial we use Blender 2.71, but any version from 2.5 on can be used. A crossing will be built based on own splines and textures. For larger intersections, a (handwritten) sketch is helpful to visualize the traffic flow in advance, but this is not necessary for the simple T-junction shown here as an example.
1. Methods
The different methods differ mainly in functionality and degree of difficulty or required prior knowledge.
Method | Advantages | Disadvantages | |
Terrain splines | The intersection is built entirely in the editor using splines. There are many terrain spline downloads in the webdisk and in the forum. | The easiest way, no Blender knowledge required | Flickering of superimposed splines, no collision of vehicles with each other when using "Invis-Splines", only limited traffic light switching possible, usually many splines necessary |
Prebuild Splines & Import into Blender | First of all a basic scaffolding (e.g. the sidewalk) is built. This is imported into Blender and then the crossing is completed. Although this method is unpopular, it provides adequate results. | No deep knowledge of Blender required, traffic light switching possible, quick fitting of the crossing to splines, export "as a whole | High number of vertices, much work, not performance friendly |
Construction according to crossing SDK | It is built with the templates from the intersection SDK. This is mainly suitable for right-angled crossings on original spline basis. | No need to deal with textures as they already exist, only little knowledge of dazzling is required, unrestricted traffic light control possible, little effort, reuse | Unflexible, firm textures |
Building completely in Blender | The complete crossing will be built in Blender. | Best possible result, preserves performance, best flexibility, unlimited traffic light switching possible, reuse, export "as a whole | Deep knowledge of Blender required, high effort, error potential high |
2. Construction of the crossing in Blender
The following part is a construction diary of an intersection.
2.1. Further assistance
The object and especially the crossing construction is a very complex subject. In this tutorial we refer to the following:
- Basic functions of Blender and important shortcuts (Blender-Tutorial, Video-Series, Shortcut 1, Shortcut 2)
- Export of an object from Blender to OMSI
- Structure of objects and .sco files
- Intersections Editor (see unofficial SDK manual (file Intersections_1_02.pdf) p.19ff. and preface)
2.2. Stem
Before modelling an intersection, the basis is fixed (especially with real maps): the splines into which the intersection will later be "fitted" (Fig. 1). These can be exported in the OMSI editor under the tab Spline export in a format (.x) readable for Blender. First, all splines involved are selected and then saved at any desired location (Fig. 2). The finished intersection object will not use the full length of the splines - but the splines are needed to connect the intersection as seamlessly as possible to the splines. This can be especially helpful in curves or slopes to maintain the aesthetics.
Now the preliminary work in the OMSI editor is finished and you can continue with Blender. After importing the .x file into Blender, the object is rotated by 90°, which can be quickly corrected. In the edit mode the normals have to be flipped additionally (W -> Flip Normals). To be on the safe side, the function Backface Culling can be activated (in the N-menu of Blender under Shading).
2.3. Prepare textures
Now the real work begins. In the solid and texture view, the object is still completely white and untextured (fig. 3a and 3b). This is now changed by adding textures. For each texture an independent material is created. To avoid unattractive effects, the following settings are used (fig. 4):
- Diffuse color to 1.0/1.0/1.0 (100% white)
- Diffuse intensity to 1.0
- Specular intensity at 0.0
As linked to Blender in the article above, each material gets exactly one texture (one tab ahead). As type an image is chosen (fig. 5). This procedure is repeated for all textures.
In this example there are now four materials, each with a texture. But these are not yet applied to the object. To do this, first remove all double points in Edit Mode (W -> Remove Doubles) and then convert the triangles to rectangles (Select All -> ALT+J).
Then the window is split by dragging the upper right corner (Fig. 6) to the left. Now switch to the UV/Image Editor in the lower left corner of the new window and switch to the top view in the large window (Numpad 7). In the edit mode the corresponding faces for each texture are now selected, then the appropriate material is selected and Assign is pressed. Afterwards the texture is selected in the UV/Image Editor. The intersection should now appear as shown in Fig. 7. This action is repeated for all textures and associated faces until the object is completely textured. (Fig. 8 ).
2.4. Modeling with Curve and Array Modifier
Now the actual modelling begins. First, individual sections that are no longer needed because they will disappear under the intersection later are deleted. In this example, this includes the green space between the later crossing sections, which later disappears under the road, and the curb, since it runs in a curve to the junction (Fig. 9). The current object can now be hidden by clicking on the eye in the upper right-hand corner, because it is initially in the way during the following work. The textures are unimportant again for the time being, so you can switch to the solid view.
Now segments for the curves are built. For the later use it is important to keep the heights: The following segments are built 0.1m lower, so that the ground is at -0.1m; the road at 0.00m and the sidewalk at 0.15m. Now a "curve segment" of 1m length (or any other length that can be changed even afterwards) is built.
In the following the Curve-Modifier is used together with the Array-Modifier. Both modifiers work with the positive x-axis as direction and the origo (0|0|0) as zero point.
It is important that the segment starts at the zero point from a fixed point (e.g. the right or left corner), which lies on an edge. The segment is built in the direction of the x-axis from the zero point (Fig. 10).
We repeat this again with all possible segments (here in the example still the edge without walkway for the left curve).
Now the segments are available and only need to be fitted. In this case, two Bezier curves are added and adjusted to the splines (Fig. 11). It is important to note that the curve is only modified in Edit mode and connects the previously defined fixed points (in our example the edges of the road). Otherwise the curve can be adjusted as desired, but the resolution should be set to 64 and radii & co. should not be changed. For the right side we add a new curve analogously.
The Curve-Modifier does not work properly if the object center has been moved from the segment and from the curve. Both object centers must be in Origo (0|0|0). To restore this, you can delete the position by pressing ALT+G.
Now the segment is selected and array and curve modifiers are added. The settings are shown in Fig. 12 (C1 is the name of the Bezier curve). Now it should look like a curve (Fig. 12). We will repeat this step for other sides per curve as well.
Now both modifiers can be applied from top to bottom (press Apply). Back in Obect mode all curves are merged with the main spline mesh (CTRL+J). Now the whole thing should look like fig. 13. Double points can be removed again. The missing piece to the following splines is added by selecting the corresponding points and pressing F. For smaller gaps the corner points can also be moved and snapped to the rest (Fig. 14). After all these steps a Remove Doubles is executed again and the modeling is finished.
2.5. Modeling with Bridge Edge Loop
This function is able to connect ends of two pieces directly. To do this, first select the two pieces to be connected and then use SPACE and search for Bridge Edge to apply the function.
2.6. Modelling with Spin Modifier
For "straight" intersections that are not adapted to splines but work on the basis of coordinates, the Spin modifier can also be used to create curves.
Mapping the textures
Now the just built part appears untextured again. Therefore the procedure is repeated from the Textures section (Fig. 6-8). Now the mapping must be adjusted.
The asphalt is mapped using U -> Project From View until the result is optimal after trying out different zoom levels. The "Curve" areas with the curb are textured slightly differently: First the surfaces are selected and as last surface the adjacent surface of the splines is selected. After U -> Follow Active Quads the curb presents itself completely textured (Fig. 16). This is also repeated for all remaining surfaces.
Now the whole crossing is textured. Now only the remaining adjacent spline pieces that no longer belong to the crossing have to be separated from the actual crossing. This is done by selecting all surfaces of our intersection using the usual selection tools (C for circle selection; B for rectangle selection; ALT+RMT to select connected surfaces). Then P -> Selection separates the parts.
Now the intersection can be moved on the x- and y-axis if necessary, so that the intersection is placed more easily in the editor.
2.7. Export & integration into OMSI
Omsi always represents surfaces in one direction only, which is comparable to the fact that in houses you cannot see a wall from the inside. The so called "normals" point right-angled from the surface in the direction of the outside, in case of crossings thus upwards.
The mesh is now ready. To check the normals, go to the Edit Mode in the right bar of the 3D-View and select the Mesh Display item. Under Normals you can select surfaces. Now you can see lines that protrude from the surfaces. The lines should point upwards. For every surface where this is not the case, W -> Flip Normals is applied. If all normals point outwards, the object can be exported to an .o3d-file. (For this purpose the object must be selected).
Now create the .sco-file, name and groups can be chosen arbitrarily.
ZitatAlles anzeigen[friendlyname]
Moscow Ring Road junction(name of the object)
[groups]
2
Wuerzburg(town)
Intersection
[rendertype]
surface
[LightMapMapping]
[fixed]
[absheight]
[surface]
[collision_mesh]
Moskauer.o3d
###################
Model Data
###################
[mesh]
Moskauer.o3d
The object file is now complete. If everything worked correctly, we can already place the intersection in the editor.
2.8. Paths
Now only the paths are missing. To get a base at all where the paths can be fitted in, Blender finds out the position and rotation of the splines. At each outgoing string the center of the spline is marked (this lies exactly between two points) and its global x- and y-coordinates are noted or written down (fig. 17).
To find out the angle, a triangle is used by extracting one point of the corner edge on the x-axis (E -> X) and creating a surface above it (F). Then the angles are displayed under Mesh Display and also noted (Fig. 18).
Now the object is opened in the intersection editor. According to the previously written down data the localization of the spline templates can now be determined. If the rotation is not correct, experiment with the values. (e.g. sign change, ±90, ±180 etc.)
If all values are correct, the paths can be added, blinkers and, if necessary, traffic lights can be set and the intersection is saved.
Now the crossing is finished and can be used.
This is how the finished intersection looks like in the editor ...
... ...and so fitted into the splines in OMSI: