Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Computer Graphics: Procedural Modelling

Similar presentations


Presentation on theme: "Advanced Computer Graphics: Procedural Modelling"— Presentation transcript:

1 Advanced Computer Graphics: Procedural Modelling
Carl Hultquist Department of Computer Science University of Cape Town Advanced Computer GraphicsCollaborative Visual Computing Laboratory

2 Advanced Computer Graphics
Objectives To introduce the field of procedural modelling and what it means for a model to be procedurally generated To examine what techniques have been researched thus far, including the following: Fractals Perlin noise Procedural texturing Cellular texturing Solid texturing L-Systems Subdivision surfaces Urban modelling Special effects 3/01/2019 Advanced Computer Graphics

3 Advanced Computer Graphics
Motivation Modelling every single object by hand is tedious! An easier alternative is to use a few parameters to “describe” the object and allow the computer to generate the object for the artist (computers are built for doing tedious things) If necessary, the artist can make small modifications afterwards to get the “perfect” object Additionally, procedural methods are extremely compact (no need to store explicit geometry or texture information, only parameters to create these) and can in some cases better represent objects than explicit representations 3/01/2019 Advanced Computer Graphics

4 Fractals: the Koch Curve
Images by Jim Loy ( 3/01/2019 Advanced Computer Graphics

5 Fractals: why they’re important
Biggest reason is self-similarity. As seen with the Koch Curve, fractals can contain entire copies of themselves. More generally, fractals are defined to have infinite resolution: so no matter how closely you “zoom in” to the fractal, there will always be an immense amount of detail. In this sense, you could also think of fractals as having various levels of detail. This has implications for modelling: by simply storing the parameters that characterise a fractal, we can iterate and zoom in as much as we need to get a suitable level-of-detail for rendering. 3/01/2019 Advanced Computer Graphics

6 Advanced Computer Graphics
3D Fractals: Mountains Probably the most common use of fractals for procedural modelling of 3D objects Consider the 2D case of a slice through a mountain: As can be seen, we progressively split up the interval over which the mountain is defined, and add random detail. 3/01/2019 Advanced Computer Graphics

7 3D Fractals: Mountains (2)
So with 3D, we instead start with a sub-section of the plane (usually a triangle, square or hexagon), and progressively split up that sub-section into smaller parts Base case 1 step 3 steps 7 steps 3/01/2019 Advanced Computer Graphics

8 An alternative for creating fractal mountains
Notice that at any stage, the mountain is simply described by a regular grid of values, each of which is the height at the given point. Also notice that the mountains are smooth in the sense that there are no irregular discontinuities in their surface. These properties allow us to describe fractal mountains using a different procedural technique: Perlin Noise 3/01/2019 Advanced Computer Graphics

9 Advanced Computer Graphics
Perlin Noise Invented by Ken Perlin. Key idea is to take a set of noisy functions at different scales, and blend them together. 3/01/2019 Advanced Computer Graphics

10 Perlin Noise: Creating a Noise Function
So how do we create a noisy function? The trick is to take a set of “random” values and interpolate between them. Consider the 2D case below: By interpolating these random values, we obtain a smooth noise function: 3/01/2019 Advanced Computer Graphics

11 Perlin Noise: Scaling Suppose then we have a 2D noise function noise(x,y), which returns the noise value at the point (x,y). We can scale the noise by defining a new noise function like this: scaled_noise(x,y,freq) = noise(x / freq, y / freq) Higher values of freq will then give much closer views of the noise, thus scaling it. 3/01/2019 Advanced Computer Graphics

12 Perlin Noise: Applications
Fractal mountains Water displacement map (giving the appearance of waves) Simple clouds Procedural texturing Marble textures Wood textures Cellular texturing: extend noise function to 2D. Useful for most texturing applications. Volumetric or solid texturing: extend noise function to 3D. Allows you to “slice” a geometric object arbitrarily and still texture it realistically. 3/01/2019 Advanced Computer Graphics

13 Advanced Computer Graphics
Lindenmayer-Systems Invented by Aristid Lindenmayer More commonly referred to as L-Systems In essence, L-Systems are a parallel string rewriting mechanism, defined by an initial string and a set of productions (or rules) to iteratively rewrite the string. A simple example: ω : A ρ0 : A → xB ρ1 : B → yA 3/01/2019 Advanced Computer Graphics

14 L-Systems: basic form As has been shown, an L-System consists of an initial string (typically called ω) and a set of productions (usually called ρx for increasing integers x) Formally, the initial string in a simple L-System is simply a sequence of symbols, and each production has the following format: ρx : pattern → replacement where pattern is a single symbol, and replacement is a sequence of symbols. For each iteration of the L-System, every occurrence of pattern in the string is replaced by replacement, and this is done in parallel over the whole string. 3/01/2019 Advanced Computer Graphics

15 L-Systems & Parallel Rewriting (1)
Consider this L-System: ω : AB ρ0 : A → xB ρ1 : B → yA Parallel rewriting means that during the first iteration, we simultaneously change the A to xB and the B to yA, resulting in the string xByA. A second iteration would then yield xyAyxB. 3/01/2019 Advanced Computer Graphics

16 L-Systems & Parallel Rewriting (2)
There’s one more catch though: What happens if more than one production could be applied to a single symbol in the string? ω : A ρ0 : A → xB ρ1 : B → yA ρ2 : A → zB It may seem silly for now (why would someone write a system like this?) but it’s important to deal with for simple cases like this L-System. The answer is that the first matching production is used, so in this case the first iteration would result in the string xB, and not zB. 3/01/2019 Advanced Computer Graphics

17 L-Systems and Context (1)
In the previous example, we had an L-System which has two rules for rewriting a symbol. This may be very necessary: sometimes we might want to use one production, but at other times we would want to use the other production. How can we distinguish between these? The answer is to add a notion of context to the L-System. This lets us examine the symbols before and after the one we’re currently rewriting, and base our rewriting decision on these symbols. Each production in a context-sensitive L-System has the following form: ρx : left-context < pattern > right-context → replacement and either or both of the “left-context < ” and “> right-context” parts may be omitted. 3/01/2019 Advanced Computer Graphics

18 L-Systems and Context (2)
ω : xA ρ0 : A > y → Bx ρ1 : B → A ρ2 : x < A → By Here are the strings that emerge from iterations of this L-System: xA xBy xAy xBxy xAxy xByxy 3/01/2019 Advanced Computer Graphics

19 L-Systems: how is the resulting string used?
So you end up with some string of symbols: then what? The usual course of action is to interpret the string as a set of drawing commands, in a similar fashion to Logo. For this reason, this is often referred to as turtle interpretation. Some common symbols used for 2D drawing are: F - Move forward length d while drawing f - Move forward length d without drawing + - Turn left by angle δ - - Turn right by angle δ 3/01/2019 Advanced Computer Graphics

20 L-Systems: Turtle Interpretation (1)
ω : F-F-F-F ρ0 : F → FF-F-F-F-F-F+F δ = 90°, 4 iterations 3/01/2019 Advanced Computer Graphics

21 L-Systems: Turtle Interpretation (2)
ω : RF ρ0 : L → RF+LF+R ρ1 : R → LF-RF-L δ = 60°, 6 iterations 3/01/2019 Advanced Computer Graphics

22 L-Systems: more extensions!
In previous examples, all turning and movement commands used the same angle and the same distance (respectively). Would be nice to be able to adjust these values: the result is a parametric L-System. Each symbol can have an associated bracketed list of values, like this: ω : A(2) ρ0 : A → B(2.4, 3) x ρ1 : B → y A(1.2, 2.2, 4) 3/01/2019 Advanced Computer Graphics

23 Advanced Computer Graphics
Parametric L-Systems You can then formulate more complex productions, like this example: ω : x F ρ0 : x < F → y F +(30) x F ρ1 : +(x) → +(x - 2) ρ2 : y < F → F F 3/01/2019 Advanced Computer Graphics

24 L-Systems: Conditions and Branching
In addition to allowing symbols to bear parameters, parametric L-Systems also allow for conditions to be placed on productions. ρ1 : +(x) : x > 20 → +(x - 2) For example, the above production will only occur if the parameter x has value greater than 20. Branching is another useful technique used by most turtle interpretation systems: the symbol [ is used to push the turtle’s state onto a stack, and the symbol ] is used to pop the turtle’s state off the stack. 3/01/2019 Advanced Computer Graphics

25 L-Systems: what about 3D?
2D turtle examples are all well and good, but lots of computer graphics applications require 3D! How do L-Systems help here? Extend the turtle interpretations to include rotation about three axes (the up, left and heading axes). This allows us to rotate in 3D space. 3/01/2019 Advanced Computer Graphics

26 L-Systems: Applications
Parametric, context-sensitive L-Systems with branching are most typically used for modelling plants and flowers. Some more recent applications have been to model road networks. 3/01/2019 Advanced Computer Graphics

27 Subdivision Surfaces (1)
Some objects are incredibly geometrically complex, and may require extraordinary amounts of storage space. Such a problem is exacerbated when the geometry needs to be transferred to another user, since the transfer of all this data may not be practical. Subdivision surfaces allow for some geometrically complex objects to be represented using a much simpler control mesh. The actual object can then be reconstructed through the process of subdivision, whereby the vertices in the control mesh are used to generate new vertices. (See, for example, Subdivision Surfaces in Character Animation, by Tony DeRose, Michael Kass and Tien Truong). 3/01/2019 Advanced Computer Graphics

28 Subdivision surfaces (2)
Positives: Only a simple mesh is stored Can subdivide to any arbitrary level of detail: quick and easy way of allow support for multiple LODs without the need of a decimation algorithm (see Hugues Hoppe’s paper on Progressive Meshes for an example of such a decimation scheme) Negatives: Not all complex objects can be represented like this Can be difficult to work out what control mesh will result in the final object we’re trying to model 3/01/2019 Advanced Computer Graphics

29 Procedural Modelling of Cities (1)
Paper by Yoav Parish and Pascal Müller for SIGGRAPH 2001. Describes a composite procedural modelling system for generating an entire city. Makes use of the following techniques: L-Systems: a variant of L-Systems is used that allows for what are called query modules, which are used to query the environment and receive feedback from the environment before a production is executed. These create the road network for the city. Subdivision: regions of land bounded by roads are subdivided into allotments, each of which will potentially contain a building. 3/01/2019 Advanced Computer Graphics

30 Procedural Modelling of Cities (2)
L-Systems: a variant known as parametric, stochastic L-Systems are used to generate buildings. The basic idea is that symbols in the L-System are interpreted as a type of sculpting command, eroding away from a solid block and resulting in a shape resembling a building. Procedural texturing: a technique which the authors call layered grids is used to generate a 2D texture for use on the buildings. The idea is to use multiple semi-random layers and have these layers interact in a number of semi-random ways to generate the final building façade. 3/01/2019 Advanced Computer Graphics

31 Procedural Modelling of Cities (3)
3/01/2019 Advanced Computer Graphics

32 Advanced Computer Graphics
Special effects Many SFX can be considered “procedural” in the sense that there is some computational procedure which creates the effect, as opposed to the effect either being captured from raw footage or painstakingly created by an artist. Examples of such effects include: Morphing and warping Physics engines Animation of characters Smooth camera movement A good example of software that is widely used to accomplish such effects is Houdini by Side Effects Software ( 3/01/2019 Advanced Computer Graphics

33 Uses of Procedural Modelling
Games: most recent and most notable is kkrieger, which is an FPS in 96 Kb! (complete with sound effects, music, and good graphics) Movies: Primarily used for SFX, but can also be used for generating large virtual environments (VEs). Good examples include The Matrix trilogy, Final Fantasy, anything by Pixar, The Day After Tomorrow, The Lord of the Rings… the list goes on! General VE design: for designing large and complex VE’s, procedural modelling can save time by doing lots of the work for you. The trick is in developing a good interface to harness its full power… (see 3/01/2019 Advanced Computer Graphics

34 Advanced Computer Graphics
Example: kkrieger Any questions? 3/01/2019 Advanced Computer Graphics


Download ppt "Advanced Computer Graphics: Procedural Modelling"

Similar presentations


Ads by Google