Content uploaded by Stanislav Kostadinov
Author content
All content in this area was uploaded by Stanislav Kostadinov on Sep 07, 2015
Content may be subject to copyright.
8
A Direct Optimisation Method with Non-uniform
Weights for 3D Terrain Grid Generation
Stanislav Dimchev Kostadinov
Department of Informatics
University of Ruse
Ruse, Bulgaria
sdkostadinov@uni-ruse.bg
Tzvetomir Ivanov Vassilev
Department of Informatics
University of Ruse
Ruse, Bulgaria
TVassilev@uni-ruse.bg
Abstract - This paper presents an approach for 3D grid
generation with a rectangular topology. It is an improved direct
optimization method. The idea of the paper is to provide a fast
algorithm for mesh generation to do a more realistic 3D terrain
models. Results and conclusions are presented at the end of the
paper.
Keywords - Grid Generation, 3D Terrain
I. INTRODUCTION
3D terrain grid generation has become a major field of
research in computer graphics in the last decade. Its main
applications are computer games, virtual museums and
archaeological reproductions. Many of the collision detection
algorithms [1][2] require a rectangular topology grid to be
generated on a 3D terrain, so that algorithms for interaction
with surfaces can be run. One of the easiest solutions is to use
an algebraic method [3], but as shown in the next sections, it
does not always produce pleasing results.
The approach presented in this paper modifies an existing
direct optimization method by computing non-uniform weights
to a length functional. Length functional differentiates
topological regions with large number of grid nodes to ensure
fine quality of the corresponding terrain area.
The rest of the paper is organized as follows. The next
section reviews previous work on 3D grid generation. Section 3
describes the direct optimization approach. Section 4 presents
the modified optimization approach using with non-uniform
weights in the functional. Section 5 gives results of the
experiments and the last section concludes the paper.
II. PREVIOUS WORK
Nowadays, development of 3D models for computer games
and 3D reconstruction of archaeological terrains leads to
research of fast and low cost solution for generation of good
quality meshes. One approach is custom made hardware and
software for generation of 3D terrains. The National
Geographic channel show called Time Scanner uses cutting-
edge 3D laser-scanning technology to put history’s buildings
and terrains to the test, exploring the secrets of how the world’s
most iconic engineering creations were constructed. The idea is
borrowed from the military development and produces high-
quality meshes representing buildings from Machu Picchu,
Petra, Egypt Pyramids, etc. Such 3D models are represented by
unstructured grids and they are useful for 3D static scenes but
are inefficient for the algorithms for interaction of objects with
grids (e.g. collision detection algorithms).
Another approach is generation of structured grids well-
known as topology grids. Most of the algorithms for generation
of topology grids are applicable both for 3D surfaces and 2D
planes. As above mentioned the fastest and easiest method to
implement is the algebraic mapping with two-dimensional
interpolation [3]. However, in many cases it does not produce
good results and more complex methods were developed that
generate smoother meshes. One of the best is the elliptic grid
generator [4] borrowing ideas from fluid dynamics and solving
partial differential equations. Its main disadvantages are that
non-linear systems of many unknowns have to be solved,
which can be done only by iterative numerical methods. As a
result the method is very slow and not suitable for real-time
simulations.
Khamayseh and Hamann [5] modified the elliptic system
using non-uniform rational B-splines (NURBS). In this
approach the original geometry is given as analytically defined
NURBS surfaces and the method is designated mainly for
generating meshes on 3D surfaces.
Castillo and Otto [6][7] proposed a direct variational
optimization approach. They treat the grid generation problem
as discrete from the very beginning. Several discrete
functionals (length, area, orthogonal) are defined and their
variation is minimized. This produces linear systems, which
can be solved much faster than for the elliptic generator. If only
the length functional is used, then the x and y coordinates are
decoupled and two independent systems should be solved, one
for x and one for y coordinates, which have the same system
matrix. This results in faster generation, but minimization only
of the length variation sometimes produces folded grids. That
is why area is added too. However, x and y coordinates are
coupled and the number of unknowns is increased twice.
The approach presented in this paper improves the length
functional by calculating a sequence of varying weights and in
this way preserves the efficiency of the method, while
improving its quality at the same time. The sequence of the
weights is calculated by a set of functions with input data - x
and y coordinates. The number of functions depends on how
rough is the terrain and each function represents weights for a
local area within the topology grid.
9
III. DIRECT OPTIMIZATION METHOD
The problem of rectangular grid generation is illustrated in
Fig. 1. Given a rectangular logical domain, on which it is easy
to generate a rectangular mesh, we have to find a mapping
function R(u,v) to the physical domain. The variables u and v
are in the interval from 0 to 1. The boundary curves R(u,0),
R(u,1), R(0,v), R(1,v) can be easily generated using an equal
length approach. So, the main problem is to find point
distribution inside area of the physical domain.
Fig. 1. The problem of rectangular topology grid generation
Castillo and Otto [6] presented a discrete variational grid
generation method. They define the following generalized
length functional (1).
2
2
,1,
2
2
,1,
2
2
,,1
,2
2
,,1
2
1
ij
jiji
ij
jiji
ij
jiji
ji ij
jiji
LD
yy
C
xx
B
yy
A
xx
F
They minimize it by setting the partial derivatives to zero.
In their functional Aij, Bij, Cij, Dij are different weights for the
horizontal and vertical edges of the grid and for the x and y
coordinates. A couple of choices are proposed for these
weights. The first is to use constant weights in horizontal
Aij=Bij=Lu and vertical Cij=Dij=Lv direction. It is easy to see
that if Lu is greater than Lv then the vertical edges have bigger
influence than the horizontal ones. In this case the
minimization of (2) leads to equation (2), which is applied to
all R(i,j)=[xij,yij], where i is between 1 and umax -1 and j is
between 1 and vmax -1.
0
)1R()1R()1R()1R(
)
22
)(R( 2222
vuvu L
i,ji,j-
L
,ji,ji-
LL
i,j
The result is a system of linear equations with (vmax-
2)*(umax-2) unknown variables. If Lu=Lv, the system matrix
elements M[k,m] can be computed in the following way. All
main diagonal elements are equal to 4. If (k=i*vmax+j) and
(m=k±1) then M[k,m]=-1. If (m=k±vmax) then M[k,m]=-1.
A well-known method for solving linear equations is the
LU decomposition. More details about the LU decomposition
can be found in [8]. However, a better choice for the current
system is the Cholesky decomposition [9], which is a special
case of LU decomposition and is used for square symmetric
matrices. The difference to the LU decomposition is that in
case of real number solutions the L and U matrices are
transposed (Lij=Uji). This speeds up the solution by removing
half of the pre-generated solution data.
Another option proposed by Castillo and Otto [6] is to use
aspect-weighted functional by setting Aij=A1hu, Bij=A2hu,
Cij=B1hv, Dij=B2hv, where hu and hv are uniform steps in the
two logical directions. According to the authors this gives
better unfolded grids in some particular cases, but does not
always guarantee a good grid. The idea of this paper, which is
described in more detail in the next section, is to use non-
uniform weights.
IV. METHOD PROPOSED IN THIS PAPER
Minimization of the length functional (1) is the fastest
direct optimization method, described in [6], but it has a major
disadvantage. It produces folded grids, as shown in the case of
2D plane grids in Fig. 2. The idea of our approach is to
compensate for this by using non-uniform weights, which are
small in the centre of the grid and gradually increase as moving
away from the centre and reach their maximum at the boundary
curves. In this way the addends in functional (2), which
correspond to edges that are closer to the boundary curves, will
have greater influence in the sum and the edges will follow the
shape of the boundary curves.
Fig. 2. Direct optimisation: left - original method, right - improved length
functional
Equation (3) exhibits the proposed formula. The weights
are close to zero in the centre of the interval and increase as
going away. The value 0.01 is added to make sure that there are
no zeroes in the sequence as its terms are in the denominator in
equations (1) and (2). The coefficient k can be set to values
greater or smaller than one to account for the different aspects
in the physical domain. As shown in the improved length
functional algorithm in Fig. 2 this produces smooth and
unfolded grids and the approach fits best to the needs of
generation of 2D topology grids. One of the major fields where
this algorithm can be applied is cloth simulation [10]. Mass-
spring based approaches require a rectangular topology and all
springs experience approximately equal stress. 3D surfaces
differ from 2D planes with variety of inclines and the method
for 3D terrain grid generation requires flexible approach that
10
generates higher-quality mesh with the same number of grid
nodes.
Fig. 3. Landscape of medieval fortress: left - virtual model, right - real view
max
max
2
max
max
max
2
max
,...,1,
])1(5.0[
01.0
,...,1,
])1(5.0[
01.0
vj
v
jv
kL
ui
u
iu
L
vj
ui
Generation of 3D terrain grids demands multi phase
generation and this algorithm for generation of non-uniform
weights does not satisfy the requirement for smooth 3D terrain
generation. This approach is tested on the landscape of the
medieval Cherven fortress located near Ruse, Bulgaria - Fig 3.
First phase of generation is similar to 2D planar grid
topology. The grid contour is extracted from the x and y
coordinates of the 3D contour. Next step is the grid generation
algorithm using the same criteria for node weight calculation.
The last phase is updating the z coordinates of the grid which
depends on the embossing of the surface. As it is shown on Fig.
3, there are areas with steep surface which demand more nodes
from the grid than other flat areas. A suitable solution for 3D
terrains similar to this example is decomposition of the weight
functions Lui and Lvj from equation (3) into set of functions
with local maximums into areas with steep surfaces.
n
kvkjvjvsj
n
kukiuiusi
LLL
LLL
1
1
Equation (4) exhibits the proposed formula sum. Lui and
Lvj are the functions from equation (3) and Lusi and Lvsj are
the new functions for 3D topology grids. Luki and Lvkj are
functions with local maximums within the steep areas. Within
these topologic areas their graphics are parabolic and outside
them they are flat surfaces. This is presented on the second
graphics in Fig. 4. The first one is the initial weight function
and the last one is the result weight function. The difference
between the maximum and minimum of these functions are
approximately the same as the difference between maximum
and minimum of the initial function.
Fig. 4. Graphics of weight functions: 1 - initial function, 2 - function with
local maximum, 3 -result function
11
Fig. 5. 3D terrain grid: 1 - simplified algorithm, 2 - proposed algorithm
V. RESULTS
The algorithm was implemented in Java 1.6.0_26 under
Windows 7. Results are shown in Fig. 4. Fig. 4 compares the
simplified algorithm and the algorithm with dynamic weights
proposed in this paper. As expected there are regions enriched
of grid nodes and as a result the quality of the 3D terrain is
better. This approach is applicable for a single or multiple
functions with local maximums. Load tests between simplified
and modified approaches indicate less than 0.1% delay of the
second approach. Such small delays can be neglected because
of the better quality of the result surface.
VI. CONCLUSIONS
This paper presented an approach for 3D terrain grid
generation. The following conclusions can be drawn. The
method produces folded grids with better quality. Its
disadvantage is the additional calculation of the result weight
function but it is reduced to loss of less than 0.1% for each new
weight function. Tests can be done with different terrains and
bigger number of weight functions.
ACKNOWLEDGMENT
The present document has been produced with the financial
assistance of the European Social Fund under Operational
Program "Human Resources Development". The contents of
this document are the sole responsibility of the "Angel
Kanchev" University of Ruse and can under no circumstances
be regarded as reflecting the position of the European Union or
the Ministry of Education and Science of Republic of Bulgaria
(Project № BG051PO001-3.3.06-0008 "Supporting Academic
Development of Scientific Personnel in Engineering and
Information Science and Technologies").
REFERENCES
[1] N. Govender, D. Wilke, and S. Kok, Collision detection of convex
polyhedra on the NVIDIA GPU architecture for the discrete element
method, Applied Mathematics and Computation, 2014
[2] T. Vassilev, B. Spanlang, and Y. Chrysanthou, Fast Cloth Animation on
Walking Avatars, Computer Graphics Forum, Vol. 3, pp. 260-267, 2001
[3] E. Smith, Algebraic Grid Generation, Numerical Grid Generation, Vol.
137, 1982
[4] F. Thompson, A. Warsi, and W. Mastin, Numerical Grid Generation,
Vol. 10, 1985
[5] A. Khamayseh, and B. Hamann, Elliptic Grid Generation using NURBS
surfaces, Computer Aided Geometric Design, Vol. 13, pp. 369-386, 1996
[6] E. Castillo, and J. Otto, A Practical Guide to Direct Optimization for
Planar Grid Generation, Computers and Mathematics with
Applications, Vol. 37, pp. 123-156, 1999
[7] E. Castillo, A discrete variational grid generation method, SIAM
Journal on Scientific and Statistical Computing, Vol. 12, pp. 454-468,
1991
[8] H. Press, and P. Flannery, Numerical Recipes in C: the Art of Scientific
Computations, 1992
[9] Y. Depeng, and D. Gregory, High Performance Reconfigurable
Computing for Cholesky Decomposition, 2009
[10] T. Vassilev, and S. Kostadinov, Planar Grid Generation for Simulation
and Visualisation, Proceedings of the Bulgarian Academy of Sciences,
Vol. 8, pp. 1061-1068, 2014