Tải bản đầy đủ (.pdf) (145 trang)

Nagivation mesh construction and path finding for architecture environment

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.55 MB, 145 trang )

NAVIGATION MESH CONSTRUCTION
AND PATH_FINDING
FOR ARCHITECTURE ENVIRONMENT

MAO LEI

NATIONAL UNIVERSITY OF SINGAPORE
2010


NAVIGATION MESH CONSTRUCTION
AND PATH_FINDING
FOR ARCHITECTURE ENVIRONMENT

MAO LEI
(B.Comp.(Hons), NUS)

A THESIS SUBMITTED
FOR THE DEGREE OF MASTER OF SCIENCE
DEPARTMENT OF COMPUTER SCIENCE
NATIONAL UNIVERSITY OF SINGAPORE
2010


Acknowledgementsttttttttttttttttttttttttttttttttttttttttttttttttttttt

Firstly, I would like to show my appreciation to National University of Singapore and
School of Computing for providing this research opportunity and scholarship for me.

Secondly, great thanks to my supervisor, A/P Tan Tiow Seng who gave me great help
in this research project and also during the whole graduate life with his invaluable


guidance and constant support. Special thanks to Dr Low Kok Lim and Dr Cheng
Ho-lun, for their guidance and help during my graduate life in which I have learned a
lot.

I would also like to acknowledge my thanks to all people in computer graphics lab,
and we have great time in last few years.

Last but not least, I would like to thank my family who encourage me with constant
love and support.

i


Table of Contentsttttttttttttttttttttttttttttttttttttttttttttttttttttttt

Acknowledgements

i

Summary

Chapter 1 Introduction

ix

…..………………………………………………

1

1.1 Motivation and Goal ………………………………………………...


1

1.2 Contribution ………………………………………………………….

5

1.3 A Statement of the Problem

……………………………………….

7

1.4 Thesis Structure ……………………………………………………..

8

Chapter 2 Related Works and Background ………………………………

9

2.1 Search Space Representation ………………………………………..

9

2.1.1 Raw Geometry Representation ………………………………

9

2.1.2 Path Lattice Representation …………………………………...


12

2.1.3 Grid Representation and Hexagonal Representation

………..

17

…………………………..

20

……………………………………………..

23

2.2.1 Precomputed Transition Table ……………………………….

23

2.2.2 A* Search ………………………………………………………

28

2.1.4 Navigation Mesh Representation
2.2 Path Finding Algorithm

Chapter 3 Navigation Mesh Construction


……………………………….

40

………………………………………………….

43

3.1.1 Delete Useless Objects ……………………………...…………

43

3.1.2 Modify Complicated Objects

46

3.1 Selecting Process

……………………………….

ii


3.1.3 Select Walkable Surface
3.1.4 Concluding Remark

……………………………………

……………………………………….


51
52

3.2 Merging Process ………………………………………………………

53

3.2.1 Adjacent Merging ……………………………………………..

54

3.2.2 3-2 Merging

………………………………………………….

56

3.2.3 Central Point Merging ………………………………………..

61

3.2.4 Concluding Remar

………………………………………..

64

3.3 Sub-division Process …………………………………………………

65


3.3.1 Recursive Sub-division Approach

………………………….

66

………………………………

69

………………………………………..

74

……………………………………………………...

75

3.5 Multiple Levels Construction ………………………………………..

77

3.5 Concluding Remark …………………………………………………

79

3.3.2 New Sub-division Approach
3.3.3 Concluding Remark
3.4 Reconstruction


Chapter 4 Path Finding Problem

………………………………………...

81

4.1 Path Finding on Navigation Mesh ……………………………………

84

4.1.1 A* Search Path Finding Process …………………………….....

84

4.1.2 Path Correction Process

……………………………………

90

4.2 Two-Level Path Finding ……………………………………………..

94

4.2.1 Proof on the Time Consuming of Two-Level Path Finding …...

96

4.2.2 Implementation on Two-Level Path Finding …………………


100

4.3 Concluding Remark ………………………………………………….

106

Chapter 5 System Built, Experiments Results and Analysis

…………….

107

………………………………………...

107

………………………………………………………

107

5.1 Tools and Libraries Used
5.1.1 OGRE

5.1.2 COLLADA DOM

………………………………………...

109


………………………………………………….

109

5.1.4 GPC …………………………………………………………...

110

5.1.3 WxWidget

iii


5.2 Experiment Results and Analysis on Navigation Mesh Construction

111

5.3 Experiment Results and Analysis on Two-Level Path Finding ………..

117

5.4 More Experiment Results ……………………………………………..

122

Chapter 6 Conclusion

References

……………………………………………………....


129

131

iv


List of Figurestttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt

Figure 1.1.1 an architecture environment (Hospital hall) ………………..

2

Figure 1.1.2 an architecture environment (Indoor room) ………………..

3

Figure 2.1.1 path lattice representation …………………………………..

13

Figure 2.1.2 path lattice representation, to find a path from location 1 to location
2

………………………………………………………….

14

Figure 2.1.3 path lattice representation, to find a path from location 1 to location

2 through a new added path node (location 3)

…………...

Figure 2.1.4 grid representation for search space representation

15

……….

17

Figure 2.1.5 hexagonal representation for search space representation …...

17

Figure 2.1.6 navigation mesh representation

……………………………

20

Figure 2.2.1 a simple navigation mesh map ………………………………...

24

Figure 2.2.2 the transition table for the navigation mesh map in Figure 2.2.1

25


Figure 2.2.3 a simple scene of gird representation

29

……………………….

v


Figure 2.2.4 beginning of A* search

……………………………………...

31

Figure 2.2.5 first step of A* search ………………………………………..

34

Figure 2.2.6 second step of A* search …………………………………...

36

Figure 2.2.7 last step of A* search ………………………………………..

37

Figure 2.2.8 final path

38


…………………………………………………

Figure 3.1.1 an indoor room, with a rug carpet on the floor

……………

44

Figure 3.1.2 an indoor room, after the rug carpet has been removed

…..

44

Figure 3.1.3 an indoor room; choose a chair with its bounding box

…..

47

Figure 3.1.4 an indoor room; represent one chair with the cover polygon of its
bounding box

……………………………………………..

48

Figure 3.1.5 an indoor room; choose all the chairs and the table ………..


49

Figure 3.1.6 an indoor room; represent the chairs and the table with the cover
polygon of their bounding box ……………………………….

49

Figure 3.2.1 merging polygons into a single convex polygon …………….

54

Figure 3.2.2 converting three convex polygons into two convex polygons

56

Figure 3.2.3 merging of mixed shapes ……………………………………

57
vi


Figure 3.2.4 example for 3-2 merging ……………………………………

58

Figure 3.2.5 converting three convex polygons into one convex polygon

61

Figure 3.2.6 one point shared with four adjacent convex polygons


…..

63

………………....

66

Figure 3.3.1 sub-division triangles and quadrilaterals

Figure 3.3.2 a floor polygon with walls is sub-divided recursively, and re-merge
……………………………………………………………………...

69

Figure 3.3.3 an optimal mesh sub-division for example shown in Figure 3.3.2
……………………………………………………………………...

Figure 4.1.1 zigzag problem in path construction

……………………...

70

92

Figure 4.2.1 best cast for sub-division for small obstacles

…………….


97

Figure 4.2.2 worst cast for sub-division for small obstacles

…………….

98

Figure 4.2.3(a) convex polygon with four obstacle polygons …………….

101

Figure 4.2.3(b) the first-level OOBB bounding box for all four polygons

102

Figure 4.2.3(c) the second-level OOBB bounding boxes, the first one for the two
obstacle polygons in the left side, and the second one for the two
obstacle polygons in the right side …………………….

102

Figure 4.2.3(d) the third-level OOBB bounding boxes, each bounding box is for
each single obstacle polygon

…………………………

103
vii



Figure 4.2.4 correcting a path according to an obstacle polygon ………

105

Figure 5.2.1 a small dining room example ……………………………..

111

Figure 5.2.2 the result of merging process ……………………………..

112

Figure 5.2.3 the result of sub-division from Figure 5.2.2 ……………….

113

Figure 5.2.4 the result of sub-division From Figure 5.2.2, as taking the chairs
and tables as small obstacles

…………………………

113

Figure 5.2.5 a level of a building ……………………………………….

114

Figure 5.2.6 the result after merging process from Figure 5.2.5


………

114

Figure 5.2.7 the result of sub-division from Figure 5.2.6 ………………..

116

Figure 5.3.1 a basic path finding example ………………………….......

117

Figure 5.3.2 another basic path finding example …………………………

118

Figure 5.3.3 path merging result from Figure 5.3.1 …………………….

119

Figure 5.3.4 path merging result from Figure 5.3.2 …………………….

120

Figure 5.3.5 a two-level path finding example …………………………

121

Figure 5.3.6 another two-level path finding example …………………….


121

Figure 5.4.1 a soap-factory example

122

…………………………………..

viii


Figure 5.4.2 merging result in soap-factory example ……………………...

122

Figure 5.4.3 navigation mesh result in soap-factory example …………….

123

Figure 5.4.4 path finding in soap-factory example (example 1)

………..

123

Figure 5.4.5 path finding in soap-factory example (example 2)

………..


124

Figure 5.4.6 a maze example ……………………………………………..

125

Figure 5.4.7 merging process in maze example …………………………..

126

Figure 5.4.8 navigation mesh result in maze example

…………………

126

Figure 5.4.9 path finding in maze example (example 1) …………………

127

Figure 5.4.10 path finding in maze example (example 2) …………………

127

ix


Summaryttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt

With the fast development of computer science technology, path finding is kept a hot

topic in research area; especially it plays an important role in game industry, video
and film industry, and large model simulation. However, these approaches and
underlying data structure construction are not suitable for all the situations.

In this thesis, we present an approach to semi-automatically construct an underlying
structure (Navigation Mesh) in the pre-computing phase, and use a two-level
path-finding algorithm during the real searching time for an architecture environment.
There are many path-finding algorithm approaches with their underlying data
structure which represents the real walkable world for game, video and film. However,
the problem arises in architecture environment is very different with these situations.
In a large hospital, hotel or airports, we need to more concentrate on those small
obstacles as tables, chairs, or beds, rather than the un-smooth walkable surface in
games or videos. The number of these obstacles is enormous in architecture
environment so that we must be careful to choose the underlying data structure
construction and also the relative path-finding.

In our approach, we construct a navigation mesh data structure for the underlying
walkable surface with only relatively large obstacles and leave enormous number of
small obstacles in the two-level path-finding phase. We will show that the real

x


searching time will be faster in two-level path-finding approach instead of normal
path-finding approach but with bigger number of navigation meshes as we must
sub-divide large navigation mesh into lots of small pieces with the enormous number
of small obstacles.

Keywords:
Algorithms, Navigation Mesh, Path Finding, Data Structures, Computer Graphics


Implemented Software and Hardware:
Microsoft Visual Studio 2005 C++, OpenGL, Ogre, Collada, gpc (General
Clipping Library), wxWidgets(A GUI Library)

xi


Chapter 1ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
Introduction

1.1 Motivation and Goal

Path finding in the context of games and films concerns the way in which a moving
entity finds a path around an obstacle; the most important feature of path finding is
real-time. Path finding has grown in very importance as games, films and their
environments have become more complex.

Real-time strategy games typically contain large areas of open terrain which is often
relatively simple to route across. There is small number of obstacles around in a big
open area. At its core, a path finding method searches a graph by starting at one point
and exploring adjacent nodes until the destination node is reached, generally with the
intent of finding the shortest route. Although graph searching methods such as a
breath-first search would find a route if given enough time, other methods, which
explorer the graph, would tend to reach the destination sooner. An analogy would be a
person walking across a room; rather than examining every possible route in advance,
the person would generally walk in the direction of the destination and only deviate
from the path to avoid an obstruction, and make deviations as minor as possible.

A common example of a graph-based path finding algorithm is Dijkstra's algorithm.

1


This algorithm begins with a start node and an "open set" of candidate nodes. At each
step, the node in the open set with the lowest distance from the start is examined. The
node is marked "closed", and all adjacent nodes are added to the open set if they have
not already been examined. This process repeats until a path to the destination has
been found. Since the lowest distance nodes are examined first, the first time the
destination is found, the path to it will be the shortest path.

Figure 1.1.1 an architecture environment (Hospital hall, take from website
/>ECID=21&CATID=90&PRDID=10772)

2


Figure

1.1.2

an

architecture

environment

(Indoor

room,


take

from

/>
We can see that the real time consuming mainly depends on the number of nodes you
need to go through. However, there is enormous number of small obstacles in an
architecture environment (As shown in Figure 1.1.1 and 1.1.2). That refers to we need
more nodes to represent the walkable area in order to avoid these obstacles. If we use
the common used path finding algorithms, whatever data structures we use for the
underlying data structure, we either need to use more nodes to guarantee the accuracy
of the final result but more time consuming, or we construct less nodes by ignoring
some obstacles to guarantee fast time consuming but less accuracy of the final result.

This gives us motivation to find a more flexible approach to solve this kind of
problems. If we can keep fewer nodes as in big terrain or outside field, and do not
increase the real searching time much for accuracy path finding, then we can perfectly
3


deal this situation in architecture environment. Our approach is to use navigation
mesh to represent the underlying data structure, only for the walkable surface with big
and obvious obstacles but leave the small and unambitious obstacles for later
processing. We can show that this will save the searching time, as the time we
consume for checking these small obstacles in path finding phase, is much less than
the time we consume for transferring more nodes because of these small obstacles in
most situations. We will prove this in later chapter in the thesis.

This thesis focuses on the underlying data structure construction, and the path finding
algorithm for an architecture environment. During the underlying data structure

construction, we choose navigation mesh as basics, and divide the walkable surface
according to the big and obvious obstacles, but leave the small and unambitious
obstacles for later path finding phase. Then we use a two-level path finding approach
for real time searching. That is to use common used path finding algorithm on the
underlying navigation mesh structure, and then check those small obstacles for the
finding path. Our goal is to do the real time searching as fast as possible and
guarantee the accuracy meantime.

4


1.2 Contribution

The main contribution of our work is the idea of splitting the obstacles in an
architecture environment into two parts. The first part with big and obvious obstacles
will be processed in the underlying data structure process to get a clear walkable
surface. The second part with small and unambitious obstacles will be checked after
the path which has already been found to correct the finding path.

We will show that the time consuming under this approach is less than the traditional
approach which process all the obstacles together in the underlying data structure
construction process, and then use a common path finding algorithm. The main
difference is the number of nodes that increased by the sub-division of the small
obstacles will be far more than the number of small obstacles we will need to check in
the path finding process. This approach can decrease the real searching time in most
situations.

Our approach is mainly based on architecture environment which has enormous
number of obstacles as chairs, desks, and sofas, and so on.


5


6


1.3 A Statement of the Problem

Basically, the problem we need to solve is that we need to find a route for users from
a specified starting location to a specified terminating location in a large 3D
architecture model.

It involves two sub problems. One is we need to decide which data structure is
suitable to use in order to represent the underlying walkable surface accurately, and
also flexible for later phase’s processing.

The other one is how to search for a shortest route normally according to a starting
point and terminating point on the constructed data structure with fastest time
consuming.

In this thesis, we only consider these architecture models are represented as triangle
based 3D models.

Summarize the above, the problem is:
Given an architecture environment model of a set of triangle meshes in 3D, a starting
point and a terminating point in 3D, construct a most neat and clear data structure for
walkable surface, and find a shortest path from the starting point to the ending point
with fastest time consuming.
7



1.4 Thesis Structure

The rest of the thesis is organized as follows:

Chapter 2 describes the related work and gives some survey of the background
knowledge on search space representation and path finding process.

Chapter 3 describes the procedure on construction of navigation mesh from a set of
triangle meshes as input

Chapter 4 describes the procedure of path finding on the navigation mesh and
proposes the algorithm of two-level path finding.

Chapter 5 concludes the whole thesis.

8


Chapter 2ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt
Related Work and Background

This thesis studies how to build a search space representation for an architecture
environment, and process a real time path finding in the constructed search space
representation. Our approach is to construct a navigation mesh representation for the
walkable surface in an architecture environment with relatively big and obvious
obstacles, and process a two-level path finding algorithm to find out the route. The
based requirement we talk about in this thesis is on the architecture environment with
enormous number of obstacles.


This chapter introduces the existing search space representation approaches to
represent the walkable surface of a 3D model, and the path finding algorithms.

2.1 Search Space Representation.

2.1.1 Raw Geometry Representation.

This is possible to process a path finding algorithm on raw geometry of the virtual
world. This approach is that we did very few modifications on the raw geometry of
the virtual world (delete all those polygons which are not walkable, and find out a
base height for the base walkable surface) before the path finding process.
9


This approach is the most naïve one for search space representation. That refers to we
nearly do nothing in the search space representation construction part. It is a very easy
work in space representation construction, but leaves all the difficulties and problems
into the path finding part.

One severe problem is that we cannot recognize correctly of the walkable surfaces
against the obstacles. Suppose the model is a set of triangle meshes in 3D space, the
only information we can retrieve is the height value of each triangle mesh. This does
not help us telling which piece of triangle mesh can be walkable, but another piece of
triangle mesh cannot be walkable.

Another severe problem is the time consuming of real path finding process. Normally
there are millions of triangle meshes for a single large level. The time consuming for
us to find a route from a starting point to a terminating point will be very long as we
need to traverse most part of the meshes, and need to differentiate different part of the
model.


Anyway, we can find a more accurate path from the raw geometry representation
against other search space representations, because the raw geometry representation
illustrates the natural representation of the model.

However, we will not use this

representation in most cases as because it cannot finish path finding process in real
10


time, and it will make the path finding algorithm too complicated.

11


2.1.2 Path Lattice Representation.

In [01], the article talked about a technique to a path finding approach in a specific
search space representation, named path lattice (the points of visibility).

A path lattice approach begins with scattering a number of points throughout the
whole 3D world. These are the initial “path nodes”. Usually, these are manually
placed in the level by the level designer himself. Then the editor will examine all the
lines between all these path nodes placed in this level to determine whether it is
possible to walk in a straight line from any path node to any other. For any lines
which can be walkable, we donate it as an edge; otherwise ignore this line. Then the
designer can use this resulting network to find a path from any node to any other. As
shown in figure 2.1.1, the whole structure is one level of the virtual world, and the
green nodes are the designer placed path nodes, and the light blue lines are the

walkable paths.

12


×