Presentation is loading. Please wait.

Presentation is loading. Please wait.

Procedural Modeling Slides for DDM by Marc van Kreveld 1.

Similar presentations


Presentation on theme: "Procedural Modeling Slides for DDM by Marc van Kreveld 1."— Presentation transcript:

1 Procedural Modeling Slides for DDM by Marc van Kreveld 1

2 Procedural modeling Creating 3D models from a set of rules – L-systems – Fractals – Generative modeling Procedural modeling gives procedural content Procedural modeling uses – many parameters that can be set – often randomness 2

3 Procedural modeling Cheaper and faster than manual construction, especially when many similar models are needed Possible to generate – the geometry – the texture – the placement of the model in a scene – whole scenes (e.g. urban: street pattern, buildings, trees, …) 3

4 Procedural modeling 4

5 5

6 6

7 7

8 8

9 9

10 10

11 Procedural modeling 11

12 Procedural modeling 12

13 Procedural modeling 13

14 Procedural modeling 14

15 Procedural modeling 15

16 Procedural terrain modeling Oldest, best known, for height maps: midpoint displacement algorithm New vertices get an elevation that is the interpolation of its neighbors, +/- some random term 16

17 Procedural terrain modeling The random term decreases in every iteration, other- wise the terrain gets more and more steep/rugged Ruggedness can be globally controlled by the standard deviation of the random term 17

18 Procedural terrain modeling Looks good, but is not natural: – symmetric with respect to high and low, but real terrains are not – real terrains are formed by erosion from wind, rain, water flow, … – ridges and valleys are not realistic Possible solutions: – apply wind and rain erosion models to the generated terrain – compute where rivulets/rivers would form based on local gradient and apply river erosion models 18

19 Procedural terrain modeling Overhangs and cliffs are not supported No global user control 19

20 Procedural terrain modeling A similar approach can be used for coastlines, but there are different coastline types Constraints are needed to ensure that the coastline does not self-intersect 20

21 Procedural terrain modeling For rivers, one must be aware that rivers and terrain height cannot be generated independently – generate a height map and determine where the rivers are – generate a river network and compute a consistent height map – with little height influence, meandering must be modeled River deltas, waterfalls, cascades, … 21

22 Procedural terrain modeling For urban environments: – start with generating a dense road network – partition the resulting blocks into lots – (a) use the lots are building footprints and raise them to random heights (skyscrapers, office buildings), or (b) place a building footprint of a house on the lot and generate the house by some scheme extrusion plus roof generation L-system or other grammar 22

23 Procedural terrain modeling 23

24 Procedural terrain modeling 24

25 Procedural terrain modeling 25

26 Procedural terrain modeling 26

27 27

28 L-systems Named after Aristid Lindenmayer Parallel grammar: every non-terminal symbol is rewritten simultaneously to get the next object Models the growth of plants Typically self-similar at different scales (like fractals) 28

29 L-systems, definition Grammar G = (V, , P) where – V is a set of symbols (terminals or non-terminals) –  is a symbol or sequence of symbols that is the start – P is a set of production rules (rewriting rules) Symbols that do not occur on the left-hand side of a production rule are terminals (constants) 29

30 L-systems, example 1 Algae: – Variables: A B – Start: A – Rules: A  AB, B  A Start: A 1 st generation: AB 2 nd generation:ABA 3 rd generation:ABAAB 4 th Generation:ABAABABA 5 th Generation:ABAABABAABAAB 30 Intuition: - A is mature and spawns a young (B), but also stays - It takes young B one generation to mature (become A)

31 L-systems, example 1 A B A AA AAA AAAA B B BB B BA tree L-system 31

32 L-systems, example 2 Non-deterministic version of algae: – Variables: A B C – Start: A – Rules: A  AB, B  A, B  C, C  A Start: A 1 st generation: AB 2 nd generation:ABA or ABC 3 rd generation:ABAAB or ABCAB or ABAA or ABCA 4 th Generation:… 32 Intuition: - It takes B one or two generations to mature

33 L-systems, bracket notation A tree can be written using brackets [ and ] that enclose branches 33 D C F E B A H I G branch subbranch AB [ CD [ F ] E ] G [ I ] H

34 L-systems, example 3 Simple tree: – Variable: S – Start: S – Rule: S  S[S]S[S]S Start: S 1 st generation: S[S]S[S]S 2 nd generation: S[S]S[S]S [ S[S]S[S]S ] S[S]S[S]S [ S[S]S[S]S ] S[S]S[S]S 34

35 L-systems, example 3 We can interpret the generated strings as drawing instructions like in Turtle Graphics: – S : draw line segment – [ : rotate by 45 degrees – ] : rotate by -45 degrees and use the state from before the matching [ S[S]S[S]S 35

36 L-systems, example 3 S[S]S[S]S [ S[S]S[S]S ] S[S]S[S]S [ S[S]S[S]S ] S[S]S[S]S 36

37 L-systems, example 4 Another tree: – Variables: A, S – Start: A – Rules: A  S[A]S[A]A, S  SS Start: A 1 st generation: S[A]S[A]A 2 nd generation: SS[S[A]S[A]A]SS[S[A]S[A]A]S[A]S[A]A 37

38 L-systems, example 4 Example of subapical growth mechanism: – new branches are created at apices (A) only – stems (S) only become longer 38

39 L-systems, control mechanisms Lineage: transfer of genetic information from an ancestor cell to its descendant cells Interactive: information (or nutrients) is exchanged between neighboring cells Lineage corresponds to context-free L-systems Interaction corresponds to context-sensitive L-systems 39

40 L-systems, context-sensitivity Context-sensitive L-systems have production rules with not just a single variable on the left side A CD  … is a production rule to rewrite B if it is preceded by A and succeeded by CD If a context-sensitive production rule can be applied and also a context-free rule, the context-sensitive one takes precedence 40

41 L-systems, context-sensitivity With brackets it gets complicated: a production rule BC G[H]M  … can be applied to the string ABC[DE][SG[HI[JK]L]MNO] because bracketed parts to the right may be skipped/ignored ABC[DE][SG[HI[JK]L]MNO] A S B C D E I G H K J L M N O 41

42 L-systems, example 5 Context-sensitive L-system: – Start: J [ I ] I [ I ] I [ I ] I – Rule: J < I  J Models a signal from the root upwards to the apices J I I I I I I J I J I I J I J J J J I J I J J J J J J J 42

43 L-systems, example 5 Context-sensitive L-system: – Start: I [ I ] I [ I ] I [ I ] J – Rule: I > J  J Models a signal from an apex downwards to the root I I I I J I I I J I I J I I I J J I J I I J J J I J I I 43

44 L-systems, signals Example where the root structure and branch structure develop simultaneously (top) Same L-system but starting with a severed branch 44

45 L-systems, geometry Branching as given by production rules is topological; no coordinates are involved yet We add symbols in the production rules that steer the process, they are ignored when applying rules The symbol “[” pushes a situation onto a stack, the symbol “]” recovers it (meaning: the branch has been drawn; continue with the stem) 45

46 L-systems, examples 3a and 3b Example: + rotates by +45 degrees, - by -45 degrees, variable S moves forward a fixed distance and draws Recall the rule S  S[S]S[S]S S  S[+S]S[+S]SS  S[-S]S[+S]S 46

47 L-systems, example 6 Grassy plant: – Variables: X F – Start: X – Rules: X  F-[[X]+X]+F[+FX]-X, F  FF + uses an angle of 25°; - uses an angle of -25°; F draws; X does not 47 6 th generation

48 L-systems, 3D models 48 The drawing state in 3D requires a position and a yaw, pitch and roll In 2D we had 2 rotation symbols, in 3D we need 6 The symbol “[” pushes a state with position, yaw, pitch and roll onto a stack, the symbol “]” recovers it

49 L-systems, appearance More symbols can be used to control color, and increase/decrease edge length and edge thickness 49 color length thickness

50 Extensions to L-systems Stochastic L-systems: – A rule is applied with a certain probability in every generation – When multiple rules can be used for the same symbol, we can assign relative probabilities describing which one to apply (cp. non-deterministic L-systems) Example: – Variable: A – Start: A – Rules: A(0.6)  A[+A][-A]A, A(0.4)  AA 50 full sparse

51 Extensions to L-systems Differential L-systems (Prusinkiewicz, Hammel, Mjolsness 1993): – Rules as in L-systems combined with differential equations – Separates discrete changes (new branch) from continuous changes (lengthening, thickening, bending) – Allows continuous growth, instead of discrete – Allows easier animations 51

52 Books 52

53 Model synthesis Procedural modeling algorithm by Merrell and Manocha (2011) Useful for man-made structures User-assisted generation Starts with a simple model, user-defined input Generates similar models with larger complexity Uses neighborhoods and constraints 53

54 Model synthesis: approach A model is a set of closed polyhedra The input model is denoted by E, the generated model by M Vertices in E have a neighborhood; all vertices in M should have a neighborhood that is the same as some vertex in E Neighborhood of a vertex: adjacency of edges and facets around the vertex, directions of those edges and facets, and side of the polyhedron w.r.t. the vertex Also points on edges and facets have neighborhoods 54

55 Model synthesis: approach 55 input model Egenerated model M

56 Model synthesis: approach The neighborhood of a vertex defines its state Given an example model E: – Determine all different occurring states in E – Generate sets of parallel planes (planes supporting facets from E), these form a 3D grid G – Loop: pick a vertex of G and assign it a possible state (using states that occur in E and the previously assigned states of adjacent vertices in G) – Until all vertices with an assigned state form a proper model in G 56

57 Model synthesis: approach 57 parallel lines (planes)

58 Model synthesis: approach 58 At a yellow vertex, we can have 16 different states in principle, 2 of which do not give a vertex (all 4 incident cells inside/outside) 4 states occur in model E (like a’, b’, c’,..) as vertices, 2 of them as edges (like e’,..) The remaining 8 states are not allowed at vertices in M

59 Model synthesis: approach 59 States described by half-planes: h 1 = below green facet; h 2 = behind blue facet; h 3 = right of red facet

60 Model synthesis: approach 60 States described by half-planes: h 1 = below green facet; h 2 = behind blue facet; h 3 = right of red facet next vertex along this edge must have state that includes h 1  h 2 next vertex along this edge must have state that includes h 1  h 3 next vertex along this edge must have state that includes h 2  h 3

61 Model synthesis: approach The algorithm again: – Determine all different occurring states in E – Generate sets of parallel planes (planes supporting facets from E), these form a 3D grid G – Loop: pick a vertex of G and assign it a possible state (using states that occur in E and the previously assigned states of adjacent vertices in G) – Until all vertices with an assigned state form a proper model in G  a model growing approach with backtracking when the algorithm finds a vertex where no state is possible 61

62 Model synthesis: approach Constraints are needed to capture the user’s intent Constraints limit what the algorithm can generate 62

63 Model synthesis: approach Dimensional constraints: limits on the lengths of features (width of roads, height of chairs, …) – all lengths will be multiples of the chosen plane spacing Algebraic constraints: limits on ratios of lengths Connectivity constraints: roads must all connect into a network; rooms in a house must all be connected – number of seeds influences number of components Large-scale constraints: more global constraints like the arrangement of buildings in a city 63

64 Model synthesis: approach Large-scale constraints – make locations in the space to be occupied – the state of a location is the object that is there – states are assigned with equal probabilities, but this can also be influenced by the user 64

65 Model synthesis: output 65

66 Model synthesis: output 66

67 Model synthesis: output 67

68 Model synthesis: output

69 Model synthesis: efficiency Number of planes depends on number of plane normals in input and on plane spacing vs. extent Backtracking is limited, and local in practice m normals and n planes per normal gives proportional to m 3 n 3 vertices in the grid Models shown have 60–400 polygons user-made (in E) and 1000–8000 polygons generated (in M) Computation time a few seconds to a few minutes 69

70 Model synthesis: limitations Needs a grid structure for the model Not good for organic models (plants, trees) Less good for curved models, but possible Less good for a combination of small (detailed) and large objects Semi-automatic 70

71 Summary Procedural generation allows models to be generated rather than built manually by artists or reconstructed from scans There are considerable time and cost savings L-systems work well for organic shapes, but they also work for buildings, road networks, … Model synthesis is a model growing technique that can be used for semi-automatic generation of man- made structures 71

72 Summary There is more to be said on placement of a model Clouds, fire, movement like leaves blowing in the wind, etc., has also been studied Procedural generation of textures exists There are various books on the topic There are several software packages for procedural generation Convenient user control remains an issue; there is a lot of trial-and-error in the generation 72


Download ppt "Procedural Modeling Slides for DDM by Marc van Kreveld 1."

Similar presentations


Ads by Google