![](https://csdnimg.cn/release/download_crawler_static/13780657/bg9.jpg)
Background
- 9 -
Figure 1.3 Illustrations of the limitations that apply to height fields. (2D equivalent)
left: (x,y) = (f
x
[s], f
y
[s])
right: (x,y) = (x, f[x])
The height field has many advantages as it is easy to use and it is easy to find a data structure that is
appropriate for storing it. It is often stored as a texture, which is called height map. The process of
rendering a surface with height map is usually called displacement-mapping as the original geometry (P
plane
in Equation 1.1) is displaced by the amount defined in the height map.
The rest of this thesis will only deal with rendering height fields and not discuss more general surfaces.
1.4 Task subdivision
As hardware is built with scan-line rendering in mind there is no way to get around that the surface must
have a polygonal representation. Thus we need to approximate the surface with some kind of grid (not
necessarily regular). As a height field representation will be used it is appropriate to generate a planar grid
first, and then displace the points afterwards.
We can divide the water rendering task into these subtasks:
1. Generate the planar grid (tessellation schemes)
2. Generate the height field and sample the points in the grid
3. Render and shade the resulting geometry
Step 1 and 2 are not strictly separate as the generation of height-data may impose certain restrictions on
how the grid must be generated. Neither do they have to be separate in an implementation. But it is good
to treat them as separate tasks from an explanatory point of view.
1.5 Tessellation schemes
A surface of water is continuous in real life as far as we are concerned. But interactive computer graphics
need a polygonal representation so the surface must be discretized. A tessellation scheme is the process of
determining in which points the height field should be sampled.
The most straightforward way to represent a surface is to draw it as a rectangular regular grid in world-
space.
The grid has a detail-level that is constant in world-space. But due to the perspective nature of the
projective part of the camera-transform (M
Perspective
) through which the geometry is rendered, the detail-level
in the resulting image will be dependant on the distance to the viewer. While this might work for a small
surface like a lake or a pond, it will not be suitable in a scene where an ocean is supposed to cover the
entire screen along with a horizon that is far away. The grid would have to be spread over such a large
area that the resulting points in the grid would be too sparse to represent the level of detail we want.
The perspective effect have the implication that we can see both parts of the surface that are close, and
parts of the surface that are distant simultaneously. In this thesis the distance between the nearest visible
point on the surface to the most distant visible point will be referred to as distance dynamic range. A
single rectangular grid is good when the dynamic range is small, but for large dynamic ranges, a more
sophisticated solution is required.
A common solution is to use what is known as a LOD (level-of-detail) scheme. The surface is divided into
a grid of patches. When rendering, the resolution of each patch will be determined by the distance to the
viewer. The change in resolution is discrete and each level-of-detail usually has twice the resolution of the
x
y
y
x