Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton...

38
Procedural Modelling of Cities Y.I.H. Parish & P. Müller esentation by Ian Eborn and Anton Burg

Transcript of Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton...

Page 1: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Procedural Modelling of CitiesY.I.H. Parish & P. Müller

Presentation by Ian Eborn and Anton Burger

Page 2: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Overview

• CityEngine

• Introduction to L-systems

• The road generation algorithm

• The building generation algorithm

• Procedural texturing system

Page 3: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

CityEngine

• Uses maps of population density, land-water boundaries, etc. to create a road network using Open L-systems

• Spaces between blocks subdivided into lots for individual buildings

• Buildings generated using parametric stochastic L-systems, detail with procedural texturing technique

Page 4: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Introduction to L-systems

• Parallel string rewriting systems

• Originally used to model plant growth

• Strings consist of symbols (“modules”)

• Uses production rules to rewrite modules

• The starting string is called the axiom, and is labelled ω

Page 5: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Intro to L-systems

• Each production rule requires at least a name, predecessor module and a string of modules, its successor

• Example:– ω: A– p1: A → AB– p2: B → BA

• Produces strings of the form ABBABAAB…• NB. Parallel rewrite system means that all possible

rewrites are made to the old string before the next iteration begins

Page 6: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Intro to L-systems

• Now associate commands with modules• Imagine a Logo-like turtle with a position and

orientation; commands executed sequentially after all rewrites in a derivation step

• e.g. F = draw 1 unit in current direction, + = turn right 60°, - = turn left 60°

• [ and ] are push and pop: remember current turtle state so we can return to it later– Allows creation of branching structures

Page 7: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

An L-system turtle

• Assume turtle starts facing straight up– ω: F– p1: F → F[-F][+F]

ω 1 iteration 2 iterations

Page 8: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

More complex L-systems

• Introduce the notion of left- and right-context– p1: A < S > B → C– Replaces S with C only if it is preceded by A and

followed by B

• Modules can have parameters– ω: F(1)– p1: F(x) → F(x + 1)– Parameters can be used to match modules for

rewriting or to affect their associated commands

Page 9: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Parameters and conditions

• Conditions provide extra prerequisites for the application of a production– ω: F(1)– p1: F(x): x < 3 → F(x + 1)– p2: F(x): x ≥ 3 → F(3)– Line stops growing at 3 units

Page 10: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Stochastic L-systems

• Specifies the probability of a particular production being applied– ω: A(5)– p1: A(x) → A(x + 1): 0.3– p2: A(x) → A(x – 1): 0.7

• Parameter likelier to shrink than to grow in this example

Page 11: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Environmentally sensitive L-systems• So far, L-systems have been more or less self-

contained• Parameters provide “global” influences from the

environment• We can provide a way to have the environment affect

the development of the system locally• Query module: ?X(x, y, z)

– X represents some property of the turtle, i.e. X = P for position, X = H, U or L for orientation vectors

– When the module is interpreted, the parameters are filled with the relevant quantities; can be used for subsequent matches or calculations

Page 12: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Environmentally sensitive L-systems

• Example from Synthetic Topiary, by P. Prusinkiewicz, M. James & R. Měch

• Need some extra modules:– % terminates a branch by deleting all the modules

from the current point to the end of this branch– @o draws a circle at the current turtle position

Page 13: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Environmentally sensitive L-systems

– ω: A– p1: A → [+B][-B]F?P(x, y)A– p2: B → F?P(x, y)@oB– p3: ?P(x, y): 4x2 + (y – 10)2 > 102

→ [+(2y)F][-(2y)F]%

Similar constructs used to represent effects of pruning, competition amongst branches for sunlight, etc.

Page 14: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

The eye-candy part of the presentation

Some results from the authors of Synthetic Topiary

Page 15: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Open L-systems

• Generalisation of environmentally sensitive L-systems

• Communication module ?E(x1, …, xn) with no restriction on number/meaning of parameters

• When interpreted, control is passed to an external function representing some part of the environment

• Environment performs calculations, optionally passes back modified parameter values to be used in the next derivation step

• Allows two-way communication between system and environment

Page 16: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

The road generation algorithm

• CityEngine uses Open L-systems for road generation• “Environment” functions are the constraints imposed

on the roads• Two types of roads: highways & streets• Highways connect areas of high population density• Streets connect the rest of the populace to the nearest

highway

Page 17: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

The production rules for roads– ω: R(0, initRuleAttr)?I(initRoadAttr, UNASSIGNED)– p1: R(del, ruleAttr): del < 0 → ε– p2: R(del, ruleAttr) > ?I(roadAttr, state): state ==

SUCCEED→ +(roadAttr.angle)F(roadAttr.length)

B(del1, ruleAttr1, roadAttr1)B(del2, ruleAttr2, roadAttr2)R(del0, ruleAttr0)?I(roadAttr0,

UNASSIGNED)

Page 18: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

The production rules for roads– p3: R(del, ruleAttr) > ?I(roadAttr, state): state ==

FAILED→ ε

– p4: B(del, ruleAttr, roadAttr): del > 0→ B(del – 1, ruleAttr, roadAttr)

– p5: B(del, ruleAttr, roadAttr): del == 0→ [R(del, ruleAttr)?I(roadAttr,

UNASSIGNED)]– p6: B(del, ruleAttr, roadAttr): del < 0 → ε– p7: R(del, ruleAttr) < ?I(roadAttr, state): del < 0

→ ε

Page 19: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

The production rules for roads

– p8: ?I(roadAttr, state): state == UNASSIGNED

→ ?I(roadAttr, state)– p9: ?I(roadAttr, state): state != UNASSIGNED

→ ε

Page 20: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Global goals

• Population density– Highways connect peaks on population density map

– End of segment shoots rays across map; each ray is sampled and sample points look up population value

– “Fitness” of ray is the sum of the population values along a ray multiplied by the inverse distance of the corresponding point on the ray

– Highway generation continues in the direction of the “fittest” ray

Page 21: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Global goals

• Street patterns– Configurable using street pattern control maps

New York:• Streets form blocks by restricting the length of a block

and the angles that streets follow

– Paris• Concentric rings around a central point, connected by

short radial streets

– San Francisco• Tries to reduce the length of non-contour streets; uses

gradient of elevation map

Page 22: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Local constraints

• Modify attributes (length, angle) of road segments in response to surroundings

• Make sure roads do not cross water and any other places you’d expect not to find them

• Creates intersections with other roads

Page 23: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Local constraints - intersections

• Don’t want more dead ends than intersections• Don’t want intersecting segments without creating an

intersection (node in the road graph)• 3 rules:

– 2 streets cross: generate an intersection

– Segment ends close to intersection: join it to the intersection

– Segment ends close to another segment: extend it and create an intersection

Page 24: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Modelling of Buildings

Once the roadmap has been generated...Allotments generated

Geometry generated

Buildings assigned textures

Textures are semi-proceduralLowers memory cost

Page 25: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Division into Lots•City divided into “blocks”

•Blocks subdivided into allotments

– Blocks assumed to be convex and rectangularConcave allotments forbidden

Page 26: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

•Simple recursive algorithmDivide longest edges that are approximately parallelStop when size less than threshold value

• Allotments without street access or too

small discarded

• Maximum building height from image map

Page 27: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Building Geometry

• Parametric, stochastic L-System

• One building per allotment

• Each building style has own set of production

rules

• Manipulate arbitrary ground plan

Page 28: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

•L-System modules:Transformation modules

Extrusion module

Branching and Terminating modules

Geometric templates

•Final shape is ground plan transformed by

L-System

•Building functionality not represented

•L-System output fed to another parser

which produces final geometry

Page 29: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Building Geometry Example:

Page 30: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

Textures• Detailed texture maps

Pictures scanned, modified and mapped

High workload – much more time than geometry

generation

Memory problems

•Procedural textures

Address many of the above problems

Cannot always model all the details

Page 31: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

• Semi-automatic texture generation“Layered Grids” technique

Generic “Style Textures”

Model simplified by 3 assumptions:Facades show 1 or more overlayed grid

structures, with most cells having the same function

Grid cells are influenced by surrounding cells

Irregularities mostly affect entire rows or

columns

Page 32: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

• Hierarchical system based on “Interval Groups”

Non-overlapping, ordered intervals

Combination of 2 groups forms a 2-D layer

Changing a single interval changes an entire

row / column – assumption 3

Individual cells can still be accessed

Page 33: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

• Layer definition:2 interval groups

Evaluation function, “eval”, between the interval

groups

Colour evaluation function, “col”

• For a point p(s, t) where eval(s, t) = 1, p(s,

t) is said to be “active” in the current layer.

• All active points are the “active area”

• If this set is partitioned, the partitions are

called “active grid cells”

Page 34: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

• If a point p(s, t) is active, col(s, t) is calledReturns colour (or other values, such as

reflectivity or bump)

• Non-rectangular areas can be formed by

assigning functions to the intervals

Page 35: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

•“Layerstacks”If a point p(s, t) on layer l is not active, the point p(s,

t) on layer l-1 is evaluated instead

•This allows for the construction of different grid-like

structures

•Functions operating between layers can be defined

Page 36: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

•Evaluation Functions can be:A procedural texture

An image map

Another nested layer or layerstack

Page 37: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.
Page 38: Procedural Modelling of Cities Y.I.H. Parish & P. Müller Presentation by Ian Eborn and Anton Burger.

L-systems reference

• Synthetic Topiary, by P. Prusinkiewicz, M. James & R. MěchProceedings of SIGGRAPH ’94, pp. 351-358