Today Terrain Generating terrain 10182001 CS 638 Fall
- Slides: 25
Today • Terrain – Generating terrain 10/18/2001 CS 638, Fall 2001
Terrain • Terrain is obviously important to many games • As a model, it is very large • Creating every point explicitly by hand is not feasible, so automated terrain generation methods are common • When rendering, some of the terrain is close, and other parts are far away, leading to terrain LOD algorithms 10/18/2001 CS 638, Fall 2001
Representing Terrain • Terrain is typically an example of a height field – z=f(x, y) for (x, y) within the limits of the space – Precludes things like caves and overhangs • There are two common ways to represent the function f(x, y) – Explicitly store the value of f(x, y) for a discrete grid of (x, y) locations • Generally interpolate (bilinear) or triangulate to get points not on the grid • Easy to figure out what the height of the terrain is at any given (x, y) • Expensive to store the entire terrain – Store a polygonal mesh • Cheaper if the terrain has large flat areas • Harder to figure out what the height is under the player (have to know which triangle they are in) 10/18/2001 CS 638, Fall 2001
Terrain Generation Methods • Paint the height field (artist generated) • Various pseudo-random processes – – Independent random height at each point Fault generation methods (based on random lines) Particle deposition Fractal terrain from meshes • Triangulated point sample methods • Plenty of commercial tools for terrain generation 10/18/2001 CS 638, Fall 2001
Painting Terrain • An artist paints a gray image – Light represents high points, dark is low – The pixels directly give the function values on the grid • The preferred method when good control is required and not too much terrain needs too be generated 10/18/2001 CS 638, Fall 2001
Random Processes • The claim is that real terrain looks “random” over may scales • Hence, random processes should generate realistic terrain – The catch is knowing which random processes • Some advantages: – Lots of terrain with almost no effort – If the random values are repeatable, the terrain can be generated on the fly, which saves on storage • A disadvantage: – Very poor control over the outcome – Non-intuitive parameter settings 10/18/2001 CS 638, Fall 2001
Random Points (Gems Ch 4. 16) • Randomly choose a value for each grid point – Can make each point independent (don’t consider neighbors) – Can make points dependent on previous points • Called a Markov process • Generally must smooth the resulting terrain – Various smoothing filters could be used • Advantage: Relatively easy to generate on the fly 10/18/2001 CS 638, Fall 2001
Repeatable Random Values • Most “random” number generators on computers are actually “pseudo-random” – Generated by functions that highly de-correlate their input • Standard random number generators produce a sequence of values given some initial seed – Warning: Most implementations are poor, so find your own – Not good enough for on-the-fly terrain, because we don’t know what order the terrain will be required • Hashing functions take a value and transform it into another value with the appearance of randomness – Used in hash tables to transform keys to hash indexes – Great for terrain – Use (x, y) as the key, and hash it to the height 10/18/2001 CS 638, Fall 2001
Fault Formation (Gems Ch 4. 17) • Claimed to model real fault lines, but not at all like real faults • Process 1: – Generate a random line and lift everything on one side of the line by d – Scale d and repeat – What does the terrain typically look like? • Process 2: – Generate a random line and lift the terrain adjacent to the line – Repeat (maybe with a scale function) – What does the terrain look like? • Smoothing is very important – The smoothing method in chapter 4. 17 has some very bad properties 10/18/2001 CS 638, Fall 2001
Fault Formation Example Initial Smoothed From Gems page 489 10/18/2001 CS 638, Fall 2001
Fault Formation Example Gems color plate 1 10/18/2001 CS 638, Fall 2001
Particle Deposition (Gems Ch 4. 19) • Supposed to model lava flow (or glacial drumlins!) • Process: – Drop a particle onto the terrain – Jiggle it around until it it is at most one unit higher than each of its neighbors – Repeat – Occasionally move the drop point around • To do volcanoes, invert everything above a plane • To do sinkholes, invert the hill • To do rows of hills, move the drop point along a line 10/18/2001 CS 638, Fall 2001
Particle Deposition Process ? ? In 3 D, more scope for random choices on jiggling particles 10/18/2001 CS 638, Fall 2001
Particle Deposition Image Gems color plate 3 10/18/2001 CS 638, Fall 2001
Fractal Terrain • Based on subdivision of a course polygon mesh • Each subdivision adds detail to the mesh in a random way • Algorithm (starting with a triangular mesh): – Split each edge, and shift the new vertex up or down by a random amount – Subdivide the triangles using the new vertices – Repeat • Also algorithms for quadrilateral meshes (See Gems Chapter 4. 18) 10/18/2001 CS 638, Fall 2001
Subdivision Method No 1 Note: Works on any triangular mesh - does not have to be regular or have equal sized triangles See my lecture notes from CS 559 for implementation details 10/18/2001 CS 638, Fall 2001
Subdivision Method No 2 • Generates a triangle bintree from the top down • Useful for LOD, as we shall see • Ideally, works for right-angled isosceles triangles 10/18/2001 CS 638, Fall 2001
Subdivision Method No 3 • Note that the middle of each square is not on an edge, so what is its initial value? • Answers vary, and Gems has one possibility 10/18/2001 CS 638, Fall 2001
Fractal Terrain Details • The original mesh vertices don’t move, so it defines the overall shape of the terrain (mountains, valleys, etc) • There are options for choosing where to move the new vertices – Uniform random offset – Normally distributed offset – small motions more likely – Procedural rule – eg Perlin noise • Scaling the offset of new points according to the subdivision level is essential – For the subdivision to converge to a smooth surface, the offset must be reduced for each level to less than half its previous value • If desired, boundary vertices can be left unmoved, to maintain the boundary edge 10/18/2001 CS 638, Fall 2001
Fractal Terrains This mesh probably doesn’t reduce the offset by much at each step. Very jagged terrain http: //members. aol. com/maksoy/vistfrac/sunset. htm 10/18/2001 CS 638, Fall 2001
Terrain, clouds generated using procedural textures and Perlin noise http: //www. planetside. co. uk/ -- tool is called Terragen 10/18/2001 CS 638, Fall 2001
Triangulated Point Sets • Start with a set of points that define specific points on the terrain – Tops of mountains, and bottoms of valleys, for example • Triangulate the point set, and then start doing fractal subdivision • What makes a good point set triangulation? 10/18/2001 CS 638, Fall 2001
Delaunay Triangulation • A triangulation with the circum-circle property: For every triangle, a circle through its points does not contain any other point • Several algorithms for computing it - look in any computational geometry book Delaunay Not - points inside this circle 10/18/2001 CS 638, Fall 2001
Populating Terrain • Coloring terrain: – Paint texture maps – Base color on height (with some randomness) • Trees: – Paint densities, or randomly set density – Then place trees randomly within regions according to density • Rivers (and lakes): – Trace local minima, and estimate catchment areas 10/18/2001 CS 638, Fall 2001
Terrain Generation Trade-Offs • Control vs Automation: – Painting gives most control – Fractal terrain next best control because you can always specify more points – Random methods give little control - generate lots and choose the one you like • Generate on-the-fly: – Random points and fractal terrain could be generated on the fly, but fractal terrain generation is quite slow – Fault generation could be modified by tiling, but continuity across tiles is difficult 10/18/2001 CS 638, Fall 2001
- Gianluca verona rinati
- Gamero 638
- A box weighing 46 newtons
- Public law 93-638
- 638 as a percentage
- 765 to the nearest 10
- Tmf service inventory
- Gamero 638
- Today's lesson or today lesson
- Today there is class
- Today's lesson or today lesson
- Meeting objective
- Characteristic of fingerprint
- Today meeting or today's meeting
- An opportunity has four essential qualities it is
- Alternative methods for generating frequent itemsets
- Moment generating function bernoulli
- Autocovariance generating function
- Fungsi pembangkit dari suatu barisan akan berbentuk
- Exe: automatically generating inputs of death
- Midpoint ellipse
- Recognizing opportunities and generating ideas
- High ohmic series resistance with microammeter
- Calculating coefficients of generating functions
- Generating alpha meaning
- Innovative ideas for revenue generation