Representation and modelling 3 – landscape specialisations

Download Report

Transcript Representation and modelling 3 – landscape specialisations

Representation and modelling 3 –
landscape specialisations
4.1 Introduction
4.2 Simple height field landscapes
4.3 Procedural modeling of landscapes- fractals
4.4 Terrain LODs: triangle bintrees
4.5 Rendering of landscapes by ray casting
4.1 Introduction



Landscapes or terrains are a common entity in
computer games.
Their total extent in screen space is large and this
means that ideally size of a landscape polygon needs
to decrease as a function of viewing distance.
LOD should ideally vary not only as a function of
the local surface curvature but globally across the
model.
4.1 Introduction
4.1 Introduction





The most popular form of landscape model is a height field
based on a uniform grid.
A classic procedural method for terrain generation – fractals –
which generates a triangle mesh.
LOD approaches to terrain exploit the normal height field
representation of landscape data and the approaches are
generally more straightforward than for arbitrary polygon
meshes.
An important consideration of landscape models is their ease of
following.
Landscapes in computer games have to be continually accessed
if objects are to be animated and checked for collision with the
terrain.
4.2 Simple height field landscapes


The easiest way to generate a height field is to use a painting
package with the understanding that the grey scale is to represent
height.
Example
4.2 Simple height field landscapes


The height field values can be mapped into a suitable colour,
depending on the nature of the landscape, and a texture map applied.
Example :
Ground texture
A view of the rendered landscape
4.3 Procedural modelling of landscapes
- fractals



Fractal geometry is a term coined by Benoit
Mandlebrot(1997,1982).
The term was used to describe the attributes of certain
natural phenomena, for example coastlines.
Fractal geometry provides a description for certain
aspects of this ubiquitous phenomenon in nature and its
tendency towards self-similarity.
4.3 Procedural modelling of landscapes
- fractals



Fractal techniques have commonly been used to generate
terrain models and the easiest techniques involve
subdividing the facets of the objects.
Subdivision in this context means taking the midpoint
along the edge between two vertices and perturbing it
along a line normal to the edge.
Most subdivision algorithms are based on a formulation
by Fournier et al.(1982) that recursively subdivides a
single line segment.
4.3 Procedural modelling of landscapes –
fractals (subdivision example)

A procedure recursively subdivides a line (t1,f), (t2,f2) generating a scalar
displacement of the midpoint of the line in a direction normal to the line.
4.3 Procedural modelling of landscapes –
fractals (subdivision example)

Triangles or quadrilaterals in 3D space, we treat each in tern, generating a
displacement along a midpoint vector that is normal to the plane of the
original facet.
4.3 Procedural modelling of landscapes
- fractals


Fournier categorises two problems in this method – internal
and external consistency.
Internal consistency



Requires that the shape generated should be the same whatever the
orientation in which it is generated
That coarser details should remain the same if the shape is replotted at
greater resoluiton.
External consistency


External consistency is harder to maintain.
Within the mesh of triangles, every triangle shares each of its sides
with another; thus the same random displacements must be generated
for corresponding points of different connecting triangles.
4.3 Procedural modelling of landscapes
- fractals



If the displacements are along the surface normal of the polygon
under consideration, then adjacent polygons which have
different normals will have their midpoints displaced into
different positions. This causes gaps to open up.
A solution is to displace the midpoint along the average of the
normals to all the polygons. This technique would create an
unsatisfactory skyline .
A better skyline is obtained by making all the displacements of
points internal to the original polygon in a direction normal to
the plane of the original polygon.
4.4 Terrain LODs: triangle bintrees



A uniform height field is conveniently triangulated
by a representation known as a triangle bintree.
Each triangle is a right-angled isosceles triangles.
The children of any node are formed by splitting the
triangle along an edge formed by joining the rightangled apex to the base to form two more rightangled child triangles.
4.4 Terrain LODs: triangle bintrees

Triangle bintree.
4.4 Terrain LODs: triangle bintrees



This structure is employed in the work of Duchaineau et
al.(1997) and Lindstrom et al.(1996)
The key idea is that a particular LOD representation for a
terrain database is a single level in the triangle bintree.
The vertices in the bintree level are associated with
corresponding height field data z (x, y)
this association is conveniently defined as :
w (v) = (x,y,z(x,y))
where:
z (x, y) is the value of the height field at the point (x,y)
the bintree domani coordinates of v
4.4 Terrain LODs: triangle bintrees
4.4 Terrain LODs: triangle bintrees
(Duchaineau et al.’s approach)




The root of the tree contains two triangles
The leaves contain triangles whose vertices are formed
from adjacent vertices in the height field grid.
Any triangle in the structure has a base, and right and left
neighbours.
Either the neighbours are form the same level, or form
the next coarsest level (base neighbours), or from the
next finer level (left and right neighbours).
4.4 Terrain LODs: triangle bintrees
(Duchaineau et al.’s approach)

A split an d merge operation defines a transition down or up a
level.

For example, when a triangle and its base neighbour are from
the same level a simple split operation is possible by adding a
new vertex.
4.4 Terrain LODs: triangle bintrees
(Duchaineau et al.’s approach)



Triangle cannot be split as shown in the previous
figure if its base neighbour is from a coarser level.
Such situation, requires that the base triangle must
be split first in a recursive sequence.
Duchaineau et al. refer to such splits as forced splits
and they use them subsequently in an optimisation
procedure.
4.4 Terrain LODs: triangle bintrees
(Duchaineau et al.’s approach)
4.4 Terrain LODs: triangle bintrees
4.4 Terrain LODs: triangle bintrees


The overall scheme consists of a pre-processing phase
and an on-line phase.
on-line phase


Consists of an algorithm that updates the previous frame’s
bintree by split and merge operations, stopping when a
geometric screen space (view-depending) error criterion is
satisfied.
pre-processing

Constructs a set of view-dependent error bounds which are
used by the on-line phase.
4.4 Terrain LODs: triangle bintrees
4.4 Terrain LODs: triangle bintrees

As the triangulation is built a priority queue is
maintained and the following operations are carried out
as long as the screen space projection is inaccurate:




Find the highest-priority triangle T in the queue.
Force split T.
Update the queue by removing T and other split triangles.
Add any new triangles to the queue.
4.5 Rendering of landscapes by ray
casting



Textured mapped uniform height fields are similar to
voxel-based data.
We can consider each cell as a voxel with a variable z
dimension, and use a voxel rendering algorithm to
produce the projected image.
The work that we now describe is typical of voxel
rendering and is due to Cohen-Or et al. (1996)
4.5 Rendering of landscapes by ray
casting


The basic algorithm is called ray casting and as the name
implies, a ray is generated from ten viewpoint through
each pixel and cast into world space.
The hit point on the terrain then gives the colour for
pixel from which the ray has emanated.
4.5 Rendering of landscapes by ray
casting