Blender Road Generator
Blender Road Generator
Master’s Thesis
ZDENĚK DOLEŽAL
Master’s Thesis
ZDENĚK DOLEŽAL
Zdeněk Doležal
iii
Acknowledgements
I would like to thank my supervisor Filip Opálený, my consultant Jiří
Chmelík, and my colleagues from polygoniq for the time devoted to
consultations and multiple rounds of feedback.
iv
Abstract
With the growth of the 3D modeling, game, and film industries, the
demand, thus the opportunity to create tools that optimize workflow
increases. Since roads are an integral part of the human environment,
they are likely to be found in digital content. This thesis deals with the
generation of procedural roads in Blender. We discuss the necessary
background knowledge, survey existing solutions, and then explore
the implementation of a Blender plugin for the procedural generation
of roads with intersections, which is the key contribution of this thesis.
Keywords
Procedural Modelling, Road Generator, Procedural Road, Blender
Addon, Crossroads, Geometry Nodes
v
Contents
1 Introduction 1
2 Background 2
2.1 Procedural Generation . . . . . . . . . . . . . . . . . . . 2
2.2 Curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Blender . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 Blender Python API . . . . . . . . . . . . . . . . . . . . . 13
2.5 Roads In Real Life . . . . . . . . . . . . . . . . . . . . . . 14
4 Proposed Method 25
4.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2 Concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.3 Segment Geometry . . . . . . . . . . . . . . . . . . . . . 27
4.4 Crossroads Geometry . . . . . . . . . . . . . . . . . . . . 41
4.5 Addon Implementation . . . . . . . . . . . . . . . . . . . 48
6 Conclusion 59
A Setup 60
B Electronic Content 62
C Third Party 63
Bibliography 64
vi
1 Introduction
Roads are an unmissable element of many environments, whether
complex street systems in cities, unpaved roads in the countryside,
multi-lane highways or cycle paths.
Interest in 3D graphics and modeling is growing [1]. Thus the
availability and variety of tools to facilitate the modeling process is
welcomed. Roads are an integral part of scenes in 3D environments.
Some form of a road is likely to be present in the scene, whether it is
architectural visualizations, movies, or games.
Manually modeling roads can be a repetitive and tedious process
in many cases. Using a procedural generator, the creation of roads can
be simplified into creating a trajectory of where the road should be and
choosing what the road should look like. Simplifying the repetitive
work allows the artist to focus on more creative and important aspects
of their work.
This thesis explores the methods and techniques of procedural
road generation, their use in the research domain, and their imple-
mentations in games and Blender.
Subsequently, selected techniques are implemented in a Blender
[2] plugin that allows the construction of a road system with simple
intersections using a custom modal interface. The system uses several
geometry generators implemented using the geometry nodes system
applied to each part of the road system and presents several options
for customization and creation of custom preset roads.
The implementation part of the thesis was done in collaboration
with the company polygoniq. The road generator will be subsequently
published in the traffiq1 addon.
1
2 Background
This chapter provides a short overview of procedural generation,
curves and their properties that are used in implementation, and
Blender procedural systems and its Python API.
2
2. Background
3
2. Background
(a) Terrain1
4
2. Background
2.2 Curves
Curves are a fundamental part of computer graphics, required for
creating smooth surfaces, smooth models, and animation transitions.
In the context of procedural generation, curves can be used to create
the curved surfaces of generated models or also as an input for the
procedural generator. The user input curves can represent branches
of a tree, a river trajectory, a fence, or a desired road trajectory.
Curves can have different forms and representations – parametric,
explicit, implicit, and polynomial (Cubic, Bézier). Each form has its
advantages and disadvantages. In the case of parametric form, the
curve is a function p(t) that accepts independent scalar parameter
t. The function yields the position at the value t. The parameter t is
commonly defined on interval [0, 1] – the curve start is at t = 0 and
the end at t = 1.
Curves can be composed to a spline to allow finer control of multi-
ple curve segments without using higher-degree curves. The spline
is a piece-wise polynomial function joined at end control points. In
the parametrized spline, the parameter spans from [0, 1] on the whole
spline, passing through all the individual curves.
In the following sections, an insight into Bézier curves is described,
focusing on how they are used in Blender and its specifics, as those
are the curves used in the implementation. Further details, equations,
and definitions of curves can be found in the book 3D Math Primer for
Graphics and Game Development [11, Chapter 13], on which this section
is based.
5
2. Background
6
2. Background
2.2.2 Extrusion
7
2. Background
2.3 Blender
2.3.1 Modifiers
Modifiers have the ability to edit the displayed and rendered geometry
of the object in a non-destructive manner, preserving the original ge-
ometry for editing. There is a variety of modifiers available in Blender,
while some are available only on certain geometry types (e. g. curves
have fewer modifiers than meshes).
Modifiers are defined on a modifier stack. The modifier stack con-
sists of one or more modifiers that apply changes subsequently to the
original mesh – their order matters. For example, one can use Array
modifier to repeat the original geometry and Shrinkwrap to place the
repeated geometry on another object.
Each modifier has settings that can be customized, as modifiers
are defined per object in Blender. The settings and specific modifier
stack applies to the whole geometry inside the object. Modifiers can be
applied to make the changes permanent – this removes the modifier
from the stack and changes the original geometry irreversibly.
8
2. Background
Figure 2.4: Example of node group with nested node group inside the
node tree editor interface.
Geometry Types
Geometry is the main data type passed through geometry nodes, it
is the base for all calculations (green links and sockets in Figure 2.4).
The flow of geometry data throughout the geometry nodes node tree
defines the resulting generated content. There are five basic types that
the geometry data type can contain, each having its specific use case.
• Mesh – Arbitrary mesh geometry, consisting of vertices, edges,
faces and face corners.
9
2. Background
Node I/O
Inputs and outputs of the main node group referenced in the modifier
are exposed to the modifier stack as demonstrated in Figure 2.5. Node
groups inside a node tree have their inputs and outputs in the form of
sockets7 .
The inputs and outputs of any Blender nodes are called sockets.
Each socket is of a different data type (e. g. float, integer, vector, string).
Inputs and outputs of user-defined node groups can be customized –
it is possible to define a type, limits of the input, default value, and a
tooltip. One socket can represent a single value or multiple values. In
the case of multiple values, the socket is called field.
Fields represent a set of values on a certain domain, the domain
is a place where the values are stored. For example, there can be a
field of type vector stored on domain face corner that represents the
UV position or a type float field stored on point representing custom
computed value. Field values are evaluated in the form of callbacks
for each data flow node, starting at the node that outputs geometry
– the same computation does not necessarily yield the same result
in different places. Detailed explanation of the evaluation system is
available on its documentation page8 .
Input or output in geometry nodes modifier can also be an at-
tribute that is created by the user (e. g. per-vertex color paint of a mesh,
7. The main node group can also be used in a node group – then its input and
outputs are also sockets.
8. Fields Evaluation https://docs.blender.org/manual/en/3.3/modeling/
geometry_nodes/fields.html#field-context
10
2. Background
Figure 2.5: Modifier stack with a geometry nodes modifier and its
inputs on an object. The inputs are defined by the geometry nodes
node tree from Figure 2.4.
11
2. Background
Figure 2.7: Result of applying the node group from 2.6 on a subdivided
quad.
12
2. Background
13
2. Background
2.5.1 Classification
Road classification is a complex topic in itself, this section is based on
the publication Review of Worldwide Road Classification Systems [13]. The
topic gives insight into how it is possible to categorize roads around
the world based on different parameters. Roads in most of the world
can be classified into hierarchical systems. For the context of this thesis
simplified classification based on road function is enough. The United
States generally differentiate between highways, arterials, collectors,
and local streets. European Union classifies only motorways, express
14
2. Background
Figure 2.8: Real world examples of roads. The first row shows roads
from the United States and the second from European Union. All
imagery is acquired from Google Street View – © Google 2023.
Highways are the major roads designed for high-speed traffic over
long distances. A typical highway has a separate roadway - multiple
lanes in each direction, physically separated by a median. The median
can be in the form of crash barriers or jersey barriers. Access to high-
ways is usually limited to usage of on, off-ramps, and interchanges,
which are designed with low curvature not to slow down the traffic
flow going to various destinations.
Express Roads / Arteries connect major destinations within a
city or a city to its regions. The number of intersections on arteries
is generally higher than on highways. Traffic signals or stop signs
are used to control the traffic at intersections. More than one lane in
each direction can be present on such roads, sometimes divided by a
median.
15
2. Background
Town Roads / Streets are roads that provide access to the local
properties and neighborhoods. Typically smaller sized roads, one lane
in each direction, with side spots for parking. Those roads usually
have features for pedestrian commuting like sidewalks, crosswalks, etc.
This type of road is also more often combined or shared with public
transport, tram tracks, bus, or taxi lanes. There can be intersections
with dedicated turning lanes and multiple traffic lights or basic yield
and primary road signs. Streets contain additional facilities for traffic
and pedestrians, like public transport stops, benches, trash bins, and
ticket machines. Streets often include greenery like trees, bushes, or
grass strips to introduce natural materials into the scenery.
2.5.2 Signs
Traffic and people movement regulation is communicated using signs.
Signs can be divided into two categories based on their location relative
to the road - vertical and horizontal. A steel pole or construction
elevates vertical signs so the information is visible high in the viewer’s
field of view. Horizontal signs are located on the road surface, and
extend the meaning of vertical signs – stop lane; or have their own
meaning – road markings. Road markings are used to control car
positioning on the roads. They split one road surface into several
parallel lanes, create a bidirectional lane of one road surface, or mark
places for parking spots.
Kerb Kerb
16
2. Background
2.5.3 Cross-Section
Road cross-section defines how the road profile looks if the road was
sliced horizontally in a direction parallel to traffic flow. The cross-
section shows how an individual element’s width contributes to the
width of the whole road. This is often defined by standards in civil
engineering10,11 . Illustrative cross-section is presented on Figure 2.9.
10. http://hgf10.vsb.cz/546/VHZ1/vyuka/doprava/rez.html
11. https://streetsillustrated.seattle.gov/design-standards/roadway-
construction/design-cross-section/
17
3 State Of The Art
Procedural road generation is a topic explored for several decades.
Various methods and implementations can be found in literature,
3D engines, internet asset stores, and games. In this chapter, we first
introduce the methods described in known literature, explore imple-
mentations in games and explore existing implementations of road
generation in Blender.
The current state of the road generation can be divided into cate-
gories based on the field. Road generation in research usually focuses
on problems of generating road networks in cities [14, 15], while fre-
quently optimizing the trajectories based on terrain [16], or in the con-
text of simulators [17], but the actual geometry generation is described
sparingly. Systems for building roads are frequently implemented in
city building and transport simulation games [18, 19], where we can
observe the behavior of the tools but not the methods behind the
implementations, as they are proprietary.
In addition to procedural generation, there are various other tech-
niques to create the geometry of the road. A common approach is
modeling the roads manually, which can be time demanding and
imprecise. It relies on estimating the real-world dimensions or trans-
ferring the data from map sources. However, nowadays, it is more
frequent that models are created using some form of sensory-based
scanning – photogrammetry or laser scanning [20, 21], which yields
precise results with high detail. High detail and realism are required
for driving (racing) simulators or for training neural network models
of self-driving cars.
18
3. State Of The Art
The system City Gen by George Kelly and Hugh McCabe [14] gen-
erates procedural roads based on the terrain and a set of predefined
primary roads. The primary road path is defined by a start and end
point and the trajectory is optimized based on the terrain. The empha-
sis here is given to generating procedural street blocks with generated
secondary roads using L-systems and lots for buildings. This system
uses a concept of a multi-level graph structure to represent the road
network.
Tensor fields are used in Interactive Procedural Street Modelling [15]
to generate the road network with the possibility of adding constraints
and editing the procedural results. Three-dimensional geometry is
created using templated segments, defined by a cross-section lane by
lane. Crossroads are limited to X and T shapes with roundabouts and
their features like traffic lights and signs can be parametrized.
Realistic Road Modelling for Driving Simulators using GIS Data [17]
proposes a method of generating realistic road systems for driving
simulators including the generation of crossroads and construction
of 3D models. This method uses various road categories with differ-
ent road profiles (defined additively in width). Emphasis is given to
constructing continuous lanes for traffic simulation and pedestrians,
from the data.
Another use case for procedural road generation is optimizing
the road path based on a variety of terrain parameters. Procedural
Generation of Roads [22] provides a method of road path optimization
between two points. The path is chosen based on a cost function while
optimizing criteria like amount of bridges (their height, pillar depth),
tunneling costs, and cost to remove vegetation. This is further extended
in Authoring Hierarchical Road Networks [16], where multiple classes
of roads can be created between multiple points. Geometry in both
cases is generated by instancing generic parametric models, which is
no further elaborated on.
Research shows that in addition to traditional curve manipulation
tools, unique interfaces were also explored. For example, Sketch-Based
Path Design [23] implements an interface that allows sketching curves
with a widget tool selector for features, which is demonstrated on
generating roads with simple crossroads.
19
3. State Of The Art
3.1.1 Overview
3.2 Games
20
3. State Of The Art
Sometimes sticking the road to the terrain is not desired if the user
wants to create a bridge or a tunnel. Height controls are implemented
in step increments. A tunnel or bridge can be built if there is enough
height difference and adequate steepness. Transport Fever also imple-
ments a selection of bridge styles, each with varying speed and looks.
The build tool in both games is entered by choosing from a selection
of various pre-defined roads, spanning from simple dirt roads, and
two-lane streets to highways, respecting the road hierarchy. Creating
a new road preset is often possible as a part of modding.
The limitation of systems in games is that there is usually no finer
customization available. The crossroads are generated with a fixed
amount of traffic lights or a pre-defined crossroad style, the road mark-
ings on the roads are not editable and customizable. The generated
geometry sometimes overlaps and is generated with errors.
3.3 Blender
21
3. State Of The Art
22
3. State Of The Art
3.3.3 Combined
Some implementations combine the procedural approach with pre-
defined models. City Road Maker [28] creates geometry on a curve
and lets the user specify what pre-modeled intersection to spawn on
one of the curve endpoints. Additional neighboring roads have to be
connected manually.
3.3.4 Other
Scene City [29] uses a custom node-based system for generating com-
plex cities and road systems. Users can use addon-specific nodes to
define building placement and road distribution. Road intersections
are available only when using meshes.
Blender OSM [30] gathers data from the OpenStreetMaps and
loads it in Blender. Buildings, roads, and terrain is generated in the
scene. Roads are currently generated as curves from the Python API
with a mesh equivalent to the width of the road and are snapped to
the ground if there is terrain below. Intersections are currently not
handled, the road meshes overlap each other, but a solution using
geometry nodes is on the way.
3.3.5 Overview
The roads in described solutions are usually generated on a curve
or a mesh. Generating on a curve has the advantage of finer control
over the curvature, but generating on a mesh allows defining points
with more than two neighbors, which is useful for crossroads. Most
of the solutions generate roads on a curve with a fixed number of
predefined parameters in one modifier, except for the Flex Road Gener-
ator [27], which provides some control of the road cross-section and
uses multiple modifiers.
Crossroads are either not handled at all or handled in a simplified
manner – predefined crossroad assets can be spawned on the endpoint,
or crossroads can be generated only when all the neighboring roads
have the same cross-section.
Most of the tools provide controls for the width of various road
elements, sizes of objects, randomness controls (seed, min, max val-
ues), material and input curve settings. In the case when geometry
23
3. State Of The Art
24
4 Proposed Method
This chapter describes our approach to procedural road generation
in Blender. We implement a solution that extends on other Blender
road generation methods by having multiple road types with different
cross-sections while generating crossroads and road mergings.
The chapter starts with the proposed requirements and follows
up with a high-level concept of the solution. Geometry generators are
described and subsequently, the implementation of the add-on and
integration of the generators concludes the chapter.
4.1 Requirements
Informal requirements were specified based on the state-of-the-art re-
search, on requirements for the polygoniq code base and best practices
of bpy usage1 .
• Blender LTS version – Implementation has to work in Long Term
Support version of Blender. Blender LTS version is supported
with fixes for additional two years. We are targeting Blender
3.3 LTS.
• Various Road Cross-Sections – As there is a large variety of
roads in real life we want to support roads with various profiles
– streets with a sidewalk, highways, customizable curbs, etc.
• Crossroads – Generate crossroads between intersecting seg-
ments. The crossroads should have reasonable geometry and
the generator should cover the most common crossroad cases.
• Real World Units – The tool will be used mostly in environ-
ment creation, where real sizes are important. All inputs that
manipulate sizes of generated geometry must correspond to
the other units in the scene.
• Reusabillity – Geometry nodes and code are created so that
parts of the system are reusable in other projects.
1. https://docs.blender.org/api/3.3/info_best_practice.html
25
4. Proposed Method
4.2 Concept
Our approach consists of a new interactive operator to build roads
which uses geometry generators to construct the road and crossroad
objects. The interactive operator provides a simple game-like interface
for constructing roads and transfers data between objects in the back-
ground to construct contextually fitting road system geometry from
multiple disconnected objects. The operator with additional support
features is presented in Section 4.5.
Road and crossroads geometry is constructed using Blender’s pro-
cedural geometry generation system – geometry nodes, as defined
in Section 2.3.2. Roads and crossroads are generated using multiple
modifiers that cooperate together and share data through the modifier
stack, similarly to Flex Road Generator [27]. Geometry generation is
split for road segments and crossroads, as illustrated in Figure 4.1.
A road segment is one section of a road with the same properties –
road profile, distributed objects, road markings, and material. Segment
generation is described in detail in Section 4.3. A crossroad generator
is used on points where any three roads meet or where two different
roads meet, its implementation is described in Section 4.4.
Segment 1
Segment 4
Segment 3
Segment 2
Crossroad 1
Crossroad 2
(different road merging)
4.2.1 Conventions
Geometry nodes node groups are stored in library .blend files un-
der the blends directory in the root folder of the addon. Library
26
4. Proposed Method
27
4. Proposed Method
Parameters
Resample Length changes the number of points in the input curve
based on input length. A value of 0.5 means that the curve points will
repeat after 0.5 meters.
Fillet Radius can be used to round sharp corners of the input curve.
The input is connected directly to the Fillet Curve node and works
the same way as described in the node documentation2 .
2. https://docs.blender.org/manual/en/3.3/modeling/geometry_nodes/
curve/fillet_curve.html
28
4. Proposed Method
29
4. Proposed Method
30
4. Proposed Method
Curve To Mesh
Custom node group CurveToMesh is a wrapper of the eponymous
Blender node (our node group is prefixed with RG_). This is the most
repeatedly used node in our generator, as it creates a selected profile
geometry across the input curve, similar to the algorithm described in
Section 2.2.2. Our node group extends the original node function by
generating UV coordinates.
The UV coordinates are calculated separately for sides, caps, and
top-bottom faces. The UV calculation is chosen in the node graph
based on the direction of face normal Fn relative to the input curve
tangent and normal Ct , Cn . The mapping functions utilize coordinates
of the profile object P and the position on the length of the curve Cl .
Individual sides mapping with their enabling conditions (conditions
are evaluated in this order in the node tree):
2. Sides – If the previous condition does not hold and the normal
is aligned to the curve normal calculated by |Cn · Fn | > 0.5 then
the mapping is in the form of uv
⃗ = (Cl , − Py ). Where the gener-
ated side is unwrapped along the curve length Cl and height
component of profile position Py . Py represents height because
the profile curve is in the XY plane at this point. Negative Py is
used to flip the coordinate growth direction.
UVs are calculated per each face corner (domain attribute for
storing UVs) and are stored in a vector named attribute @uv that
can then be accessed in a material shader for mapping. Mappings
are flipped so the growth starts on the top-left corner of the mesh
and grows to the bottom-right corner for predictable results. The
mapping direction is mirrored along the input curve, so by default, the
31
4. Proposed Method
32
4. Proposed Method
4.3.3 Distribute
Distribute modifier can be used to repeatedly instance additional
objects on a curve in a regular pattern. Useful to add additional detail
to the road by instancing objects that surround roads in real life, like
lamps, trash cans, benches, and others.
The instanced objects are input to the modifier as a collection, those
objects will be repeatedly created as instances based on user-specified
parameters. In the case of multiple objects in the collection, the objects
are instanced in alphabetical order repeatedly.
33
4. Proposed Method
⌊C p ⌉
Di = Pi mod
N
Then the points do not change positions and are left in the same
places and used as base positions for instancing. However, if the num-
ber of points in the curve C p is less than the required points by the
instancing, then some positions will be omitted completely. This is
left up to the user to use a finer curve for finer detail and adjust the
parameters accordingly.
34
4. Proposed Method
Additional Control
There are additional input parameters that allow finer control of in-
stanced objects. The instances can be mirrored (offset in the direction
opposite to normal) using Mirror modifier parameter.
Default, randomized and seed values can be controlled for the
Rotation, Scale, and global Offset. The default value specifies a value
that applies to all instances – e. g. rotate all lamps by 90 degrees and
offset by 20cm. The randomized value defines an interval from which
a random value is chosen to be added to the default value uniquely
per each instance with seed control using the seed value. Rotations of
all instanced objects are by default aligned to the base curve normal
vector. Offset is in world coordinates, not relative to the alignment.
35
4. Proposed Method
The RoadMark modifier can be used to add road markings that follow
the original curve with a specific offset along the normal direction.
Road markings are generated as a mesh on the offset curve. The gen-
erated mesh is ray-casted to the road geometry, so the user does not
have to adjust the position manually to the road surface. Figure 4.7
showcases possible results of the markings generator.
Additional Control
36
4. Proposed Method
4.3.5 Crosswalks
2. Line L with the length equal to the width of the road is created
on the position defined by Position From Start. The line is
aligned to the direction of normal and additionally rotated
based on Rotation input.
37
4. Proposed Method
4.3.6 Scatter
The scatter modifier instances one or more objects from a collection on
a surface of an object. This is a supplementary modifier as scattering
is a topic in itself and is not related only to the road generation. There
are add-ons that specialize in scattering for Blender like GeoScatter3 .
However, to provide a complete modifier package, a simple scattering
modifier was implemented. One of the main goals was to have control
of the proximity of scattered assets to the road surface to prevent
overlaps and unwanted geometry.
The implementation contains two variants of scatter node groups,
both using the same base but with different approaches. The first
approach is scattering from the perspective of the road object, im-
plemented in ScatterToTarget. The modifier is added onto the road
object and Target Collection for scattering is specified as input – all
objects in that collection will be considered as scattering targets. In
the second approach, the modifier (Scatter) is present on the object
where the objects are scattered, which is the usual implementation.
3. https://www.geoscatter.com/
38
4. Proposed Method
Parameters
In addition to inputs described for proximity and objects, it is possible
to control multiple parameters. The most important parameter is the
Density that controls the number of scattered assets per square meter.
In case of unwanted overlaps of the scattered assets the Collision
Distance parameter can be set, defining the minimal distance between
scattered points.
To allow finer control based on the properties of the input mesh,
parameter Boundary Min Distance removes the instances that are
close to the outer edges of the mesh, Align To Face Normal aligns
the rotation to the normal and Max Slope limits the instancing to a
certain slope.
Similarly to Distribute modifier, the scatter allows control of the
base and randomized values of scale, rotation, and seed inputs. An
example of different parameters configuration is presented in Figure
4.10.
39
4. Proposed Method
4.3.7 Cleanup
The Cleanup node group should always finalize the road segment
modifier stack. This node uses Merge By Distance node to merge all
closely overlapping geometry based on the user-specified distance.
In addition to the geometry cleanup this node also has a boolean
input called Realize Instances. If the input is toggled in then all the
instances are converted to a mesh before they are output. This input is
important for further conversion to a mesh of the generated geometry
as the Blender operators for converting curve to mesh do not consider
instances from the geometry nodes system.
40
4. Proposed Method
ROAD 2
p2
2 3 2
0 p0 1 0 p0 1
ROAD 1 p1 p0 ROAD 0
ROAD 0
ROAD 0
41
4. Proposed Method
ends at the furthest point of the road surface from the middle of the
road (along the endpoint normal). The construction of one adjacency
in detail can be seen in Figure 4.12.
SIDEWALK
ROAD 2
p2 r2
w2 r1 SIDEWALK
w1 ROAD 1
p1
Figure 4.12: Adjacency detail. The adjacency base curve begins and
ends at the furthest road surface points r1 and r2 . The position of the
points can be calculated by offsetting along the normal vector of the
curve at p1 and p2 using road surface half-widths w1 and w2 .
42
4. Proposed Method
Figure 4.13: Crossroad with four adjacent roads generated using cross-
road modifiers.
Register Adjacency
The RegisterAdjacency modifier registers the adjacency of two roads
by creating multiple curves with various parameters that are further
reused in follow-up modifiers.
Each adjacency modifier creates three curves. Those are marked
with an integer named attribute @type stored per each spline, so it is
possible to distinguish those curves in subsequent modifiers in the
stack. Each curve type has its specific use case:
43
4. Proposed Method
• @type = 0 – This is the same curve as −1, but its height po-
sition is adjusted based on the input parameters. The curve
of type zero is used as the base for the crossroad mesh in the
Build modifier and can be used for road markings of the whole
crossroad.
44
4. Proposed Method
The normal and tangent are received based on the specified posi-
tion of the end point from the road object. In geometry nodes, it is pos-
sible to sample information from other geometry using the Transfer
Attribute node. However, it is not possible to sample curves by po-
sition, which we require. In order to sample the curve by position a
custom solution was created. The curve is converted to mesh and the
index i of the nearest point is sampled, then using this index i we can
use the Transfer Attribute to transfer the normal and tangent from
the original curve geometry based on position. In order to always
return the normal and tangent in a consistent direction for both the
start and endpoint of the curve, they are scaled by −1 in the case of
an endpoint. This implementation is present in a custom node group
called CurveSampleNearest.
Using the sampled normal and tangent we can calculate the points
and handles and create a Bézier arc connecting the two roads. Points
r1 and r2 as defined in Crossroad Decomposition 4.4.1 are used as
the start and end point of the arc. One point is used for both start
and end arc handles as a baseline. We try to calculate the point by
finding the estimated intersection4 of the tangents as seen in Figure
4.14a. However, such a point might not exist in all cases. When the
roads have parallel tangents (in the case of T crossroad) there is no
intersection. In such case, the mean position of r1 and r2 is used as
illustrated in Figure 4.14b.
Profile
The crossroad Profile modifier works in a similar way to the profile
modifier for the road segment. The main difference is that the cross-
road profile modifier always creates geometry on the curve from the
last registered adjacency.
This modifier reuses the CurveToMesh node (described in Section
4.3.2), thus the generated mesh already has working UV mapping,
and custom profile objects are supported.
Multiple profile modifiers can be present after the register adja-
cency modifier. Similarly to one segment profile modifier subsequent
45
4. Proposed Method
RO SI
DE
AD W
AL
2 K
SI
r2
DE
W
r2 t2
AL
SI
K
DE
ph
SI
W
DE
r1
AL
W
t1
K
AL
K
ph r1 t1
RO
AD
RO
RO
AD
AD
1
1
t2
Build
The Build modifier uses curves from previous modifiers to build the
road surface of the crossroad.
The geometry of the road surface is constructed using a node
called Fill Curve. This node triangulates the area constrained by
given curves. The node requires the curve to be in one piece – the
individual curves from previous modifiers need to be joined together.
Each adjacency modifier created two curves that contribute to the
final boundary of the crossroad mesh. The first is the arc between two
adjacent roads and the second is a curve line following the normal
of the first road. However, it is not possible to join all curves into one
curve directly. We use a solution where the curves are first converted
to a mesh, then the vertices (points) are merged by distance with
46
4. Proposed Method
4.4.3 Limitations
The main limitation of the crossroad generator is that in the real world,
there are sometimes crossroad adjacencies with very sharp corners.
For such cases, parameters to tweak the sharpness Road 1 Sharpness,
Road 2 Sharpness of the adjacency were introduced. Those parameters
affect what position is used for the handles of the base curve arc. Based
on the parameter the position interpolates between the intersecting
point and the furthest road surface point along normal.
The generated crossroad has to be on the same height level. It is
possible to generate a crossroad that is inclined, but the generated
geometry will have visible steps and it will not be smooth.
The crossroad surface mesh generated from the Build modifier
does not consider the profiles of the incoming road surfaces and gen-
erates flat. In most use cases this is negligible, in real life, a typical
crossroad surface is flat, if not considering special use cases, which
would have to be modeled manually anyway.
47
4. Proposed Method
One road type is the modifier stack and its values. All the roads that
can be added to the scene are predefined in separate .blend files. The
.blend file has to comply with the following conventions:
2. There is one curve object with the same name as the .blend file
3. The modifier stack present on the curve object defines the road
type.
48
4. Proposed Method
The parsed values are stored in the RoadType class, which pro-
vides API for accessing features of the road type and is then used to
determine properties of crossroads.
49
4. Proposed Method
User Input
A click of a button invokes the operator. After the button click the user
interface switches to road-building mode, overlays are shown and the
3D view is set to top-down. The user can click to start a road segment
with the selected road type and with a second click a road segment
is built. If the user selects a point that requires creating a crossroad,
then a crossroad is created with the second click. The operator can be
closed with an escape key. All possible keyboard inputs are shown in
the overlay to guide the user.
Only inputs relevant to the movement of the 3D view and the op-
erator itself are handled. This allows passing of other non-relevant
inputs back to the Blender event system, which keeps other user inter-
face features interactive and we can use a Blender interface to control
additional properties in the addon panel.
The Build Roads operator implements two types of snapping for
more precise controls. First is snapping to a grid, which is similar to
Blender’s behavior – by holding CTRL key the current point snaps to a
grid. The snapping grid size can be modified. The second type is the
snapping of current build points to other build points if the mouse
cursor is in range of the underlying road width.
Overlays
50
4. Proposed Method
51
4. Proposed Method
52
4. Proposed Method
Build Points
Segment building can start and end on different points. Those points
are called Build Points and are based on the information from the
road network and current mouse position. There are three types of
build points:
• EmptyBuildPoint – There is only an empty space under the
mouse cursor.
• RoadSegmentBuildPoint – Build point is located on an existing
road segment and contains information about the index of the
point on the segment and the road segment itself. Each point
of the Bézier spline (except endings connected to crossroads)
is considered a road segment build point.
• CrossroadBuildPoint – If crossroad is under the mouse cursor,
the reference to crossroad is stored in the build point. Each
crossroad corresponds to a crossroad build point.
53
4. Proposed Method
4.5.6 Utilities
Spawn Road
In addition to the road system builder, there is also a possibility to
load a curve containing a road segment directly using the Spawn Road
54
4. Proposed Method
operator. This use case is viable for scenes without crossroads or com-
plex road features. For some users, it might be simpler to get the curve
object with road geometry nodes and tweak the curve manually to
their liking using native Blender workflow.
Similarly to Spawn Road a Draw Road operator is present that loads
the road into the scene, but it also starts the draw curve operator.
Convert To Mesh
When the generated road geometry is finalized, or some specific
tweaks are required, it is expected to have access to the generated
geometry. However, this is not possible directly, as the objects in the
scenes defining the road systems use modifiers, and the generated
geometry is not editable.
The Convert To Mesh operator takes selected objects generated
by the road generator and converts them to editable mesh. The oper-
ator firstly goes through all Cleanup modifiers and sets the Realize
Instances input to true. This allows a subsequent call of the Blender na-
tive Convert Curve To Mesh operator that applies all geometry nodes
modifiers, resulting in an editable mesh.
55
5 Early Feedback and Further Work
Based on internal testing and discussion with 3D artists, the road
generator seems a good baseline for 3D visualizations, and the ba-
sic features seem to be implemented accordingly to requirements
specified in Section 4.1. Throughout internal testing sessions and de-
velopment, a lot of feedback and suggestions were provided. Some
suggestions, like mirroring for various modifiers or having global
resampling options were implemented. However, there were requests
for additional features that would increase the scope dramatically.
Limitations, requested features, and possible solutions are discussed
in the subsequent sections.
5.1 Limitations
56
5. Early Feedback and Further Work
5.1.3 Expressivity of UI
Using a custom modal operator hides the native Blender functionality
behind it. On the one hand, this benefits novice users unfamiliar with
all Blender functionality – the addon works for them out of the box.
However, for users with detailed knowledge about Blender, the op-
erator may hide some customizability, as if they customized curves
by hand. Our solution provides simple options to spawn one road
segment, which the user can edit in any way likable and does not
necessarily have to use the modal operator.
Terrain Adaptation
If the user scene already contains terrain, it might be difficult to create
the road system to fit the terrain as the roads do not adapt to the terrain
automatically.
57
5. Early Feedback and Further Work
This would require changes to the geometry nodes and how the
input is handled. This feature is already prototyped. However, the
solution is not polished enough and does not work as expected in
some cases.
With a proper height adaptation solution, there is also a require-
ment for generating bridges and tunnels, as sometimes the road would
become too steep or too far from the ground.
Road Editor UI
The complex modifier stack for road segments and crossroads is hard
to edit manually as there is a lot of information and it requires knowl-
edge of how the system works.
This will be solved in the future by introducing a segment and cross-
road editor panels. Inside editor panels modifiers will be grouped
according to their functionality – e. g. cross-section modifiers, dis-
tribution modifiers, road markings modifiers, and their respective
parameters in a custom specialized interface.
58
6 Conclusion
To tackle the thesis topic, the Blender procedural geometry generation
system – geometry nodes – was studied on several small experimental
projects. A survey of other solutions on various popular Blender addon
distribution platforms was conducted, as well as a research of solutions
and methods used in the published literature and gaming worlds.
The results of the work are two libraries containing geometry nodes
for generating road segments and intersections and a Python plug-in
that extends Blender with a custom interface for creating road systems.
With this combination, we have a unique ability to create intersections
where several roads that differ in parameters other than width meet.
However, if the users do not feel like using all the plugin’s custom user
interfaces, they can use only the procedural generators with native
Blender curve editing tools.
The goal was to create a design that is extensible for the future, as
there are plans to work on the solution in the future. Since we have all
the information regarding the road segments available in the code, it is
possible to bypass the limitations of the procedural generation system
and use custom algorithms that solve the problems more creatively.
Implementing our solution in the Blender environment proved
that Blender is not a game engine and there are limitations. Some
features are not implementable because of the lack of access to under-
lying Blender data, and some require workarounds. However, as a
3D creation suite, Blender seems exceptionally extensible, allowing
developers to push for innovative game-like solutions.
The addon has been tested internally, and feedback from several
people has been considered in its development. Further work will be
done on the addon to improve the existing features, and then it will
be released as part of the traffiq addon by polygoniq. With a few
more iterations, the addon will be fine-tuned, and a broader library of
roads will be gradually created. All images of the generated roads in
this work come from the implemented generator.
59
A Setup
1. Launch Blender 3.3 LTS.
2. Open preferences by opening up the Edit menu.
3. Click Install in the top right corner and select the road_generator.zip
file provided in the electronic attachment.
60
A. Setup
61
B Electronic Content
The electronic thesis archive contains the following:
62
C Third Party
Code
Logging from polygoniq shared library polib is used. The library and
the addon are shared under GNU GPL 3.0 license2 , complying with
the licensing rules of extending Blender.
63
Bibliography
1. 3D Mapping And 3D Modelling Market – Growth Trends COVID-
19 impact, and forecasts (2023 - 2028) [online]. 2023. [visited on
2023-04-28]. Available from: https://www.mordorintelligence.
com/industry-reports/3d-mapping-and-3d-modelling.
2. COMMUNITY, Blender Online. Blender – a 3D modelling and
rendering package. Stichting Blender Foundation, Amsterdam:
Blender Foundation, 2023. Available also from: http : / / www .
blender.org.
3. EBERT, David S.; MUSGRAVE, F. Kenton; PEACHEY, Darwyn;
PERLIN, Ken; WORLEY, Steven. Texturing and Modeling: A Proce-
dural Approach. 3rd. San Francisco, CA, USA: Morgan Kaufmann
Publishers Inc., 2002. isbn 1558608486.
4. SMELIK, Ruben Michaël; TUTENEL, Tim; BIDARRA, Rafael;
BENES, Bedrich. A Survey on Procedural Modeling for Virtual
Worlds. In: 2014.
5. Houdini [online]. Side Effects Software. [visited on 2023-04-28].
Available from: https://www.sidefx.com/.
6. BENES, Bedrich; STAVA, Ondrej; MECH, Radomir; MILLER,
Gavin. Guided Procedural Modeling. Computer Graphics Forum.
2011, vol. 30, pp. 325–334. Available from doi: 10.1111/j.1467-
8659.2011.01886.x.
7. Speed Tree [online]. Interactive Data Visualization, Inc. [visited on
2023-04-28]. Available from: https://store.speedtree.com/.
8. LINDENMAYER, Aristid. Mathematical models for cellular in-
teractions in development I. Filaments with one-sided inputs.
Journal of Theoretical Biology. 1968, vol. 18, no. 3, pp. 280–299. issn
0022-5193. Available from doi: https://doi.org/10.1016/0022-
5193(68)90079-9.
9. Wolfram Tones [online]. Wolfram, 2005. [visited on 2023-04-28].
Available from: https://tones.wolfram.com/.
64
BIBLIOGRAPHY
10. Defining Loot Tables in ARPG Game Design [online]. Game De-
veloper, 2014. [visited on 2023-04-28]. Available from: https :
//www.gamedeveloper.com/design/defining- loot- tables-
in-arpg-game-design.
11. DUNN, Fletcher; PARBERRY, Ian. 3D Math Primer for Graphics
and Game Development [online]. 2011. [visited on 2023-03-15].
Available from: https://gamemath.com/book.
12. Blender 3.3 Reference Manual [online]. Blender Foundation, 2023.
Available also from: https://docs.blender.org/manual/en/3.
3/index.html.
13. PARAPHANTAKUL, Chutipong. Review of Worldwide Road
Classification Systems. In: 2014. Available from doi: 10.13140/
RG.2.1.4579.7843.
14. KELLY, George; MCCABE, Hugh. Citygen: An Interactive System
for Procedural City Generation. In: 2007.
15. ESCH, Greg; WONKA, Peter; MÜLLER, Pascal; ZHANG, Eugene.
Interactive procedural street modeling. In: 2007, 35–es. Available
from doi: 10.1145/1278780.1278822.
16. PEYTAVIE, Adrien; GALIN, Eric; GUÈRIN, Eric; BENES, Bedrich.
Authoring Hierarchical Road Networks. Computer Graphics Forum.
2011, vol. 30. Available from doi: 10.1111/j.1467-8659.2011.
02055.x.
17. DESPINE, Guillaume; BAILLARD, Caroline. Realistic Road Mod-
elling for Driving Simulators using GIS Data. In: 2011, pp. 431–
448. isbn 978-3-642-19213-5. Available from doi: 10.1007/978-3-
642-19214-2_29.
18. Cities Skylines [Game [PC]]. Sweden: Paradox Interactive, 2015.
Available also from: https://www.paradoxinteractive.com/
games/cities-skylines/about.
19. Transport Fever 2 [Game [PC]]. Switzerland: Urban Games, 2021.
Available also from: https://www.transportfever2.com/.
65
BIBLIOGRAPHY
66
BIBLIOGRAPHY
67