0% found this document useful (0 votes)
29 views9 pages

Viewshed Analysis

This paper presents a parallel algorithm for viewshed analysis in 3D digital earth using GPUs. The algorithm generates an occlusion for each geometric entity to mark the visible region within a stencil buffer. This approach integrates viewshed calculation with rendering and is more efficient than traditional line-of-sight algorithms as it does not require DEM interpolation.

Uploaded by

birayours
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views9 pages

Viewshed Analysis

This paper presents a parallel algorithm for viewshed analysis in 3D digital earth using GPUs. The algorithm generates an occlusion for each geometric entity to mark the visible region within a stencil buffer. This approach integrates viewshed calculation with rendering and is more efficient than traditional line-of-sight algorithms as it does not require DEM interpolation.

Uploaded by

birayours
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Computers & Geosciences 75 (2015) 57–65

Contents lists available at ScienceDirect

Computers & Geosciences


journal homepage: www.elsevier.com/locate/cageo

A parallel algorithm for viewshed analysis in three-dimensional


Digital Earth
Wang Feng a, Wang Gang a,n, Pan Deji a, Liu Yuan a, Yang Liuzhong b, Wang Hongbo c
a
State Key Laboratory of Remote Sensing Science, The Institute of Remote Sensing and Digital Earth, Chinese Academy of Science, Beijing 100101, China
b
Urban-Rural Planning Management Center, Ministry of Housing and Urban-Rural Development of the People's Republic of China, Beijing 100835, China
c
Managers Training Institute, China National Petroleum Group, Beijing 100096, China

art ic l e i nf o a b s t r a c t

Article history: Viewshed analysis, often supported by geographic information systems, is widely used in the three-
Received 17 April 2014 dimensional (3D) Digital Earth system. Many of the analyzes involve the siting of features and real-
Received in revised form timedecision-making. Viewshed analysis is usually performed at a large scale, which poses substantial
16 October 2014
computational challenges, as geographic datasets continue to become increasingly large. Previous re-
Accepted 29 October 2014
search on viewshed analysis has been generally limited to a single data structure (i.e., DEM), which
Available online 6 November 2014
cannot be used to analyze viewsheds in complicated scenes. In this paper, a real-time algorithm for
Keywords: viewshed analysis in Digital Earth is presented using the parallel computing of graphics processing units
Viewshed analysis (GPUs). An occlusion for each geometric entity in the neighbor space of the viewshed point is generated
Digital Earth
according to line-of-sight. The region within the occlusion is marked by a stencil buffer within the
GPU
programmable 3D visualization pipeline. The marked region is drawn with red color concurrently. In
Visualization
Vertex shader contrast to traditional algorithms based on line-of-sight, the new algorithm, in which the viewshed
Pixel shader calculation is integrated with the rendering module, is more efficient and stable. This proposed method
of viewshed generation is closer to the reality of the virtual geographic environment. No DEM inter-
polation, which is seen as a computational burden, is needed. The algorithm was implemented in a 3D
Digital Earth system (GeoBeans3D) with the DirectX application programming interface (API) and has
been widely used in a range of applications.
& 2014 Elsevier Ltd. All rights reserved.

1. Introduction A viewshed, in the virtual terrain environment, is a collection of


points that are visible from a specific point. Viewshed calculations
Digital Earth, as a multi-resolution, three-dimensional (3D) are potentially time consuming, mainly because extensive inter-
representation of the planet, allows users to locate, visualize, and polation is necessary when using a gridded digital elevation model
interpret vast amounts of geo-referenced information. In addition (DEM) due to the complex terrain model and the complicated
to its primary functions of displaying the world's terrain and re- geometric features. In addition to the time complexity, multi-point
mote sensing imagery, one of the most valuable functions of Di- viewshed analyzes and the integration of viewshed calculations
gital Earth is spatial analysis, which is the primary function of 3D with Digital Earth to speed up the calculation of dynamic view-
Geographic Information Systems (GIS) (Shi and Liu, 2005). View- shed analyses are also major challenges to researchers. Therefore,
shed analysis is one type of these spatial analyzes. This process much work has been conducted to develop an efficient viewshed
involves predicting the total area that is visible from a single point algorithm. Section 2 provides a brief overview and discussion of
or multiple points (Zhou and Liu, 2006). Viewshed analysis has previous work on viewshed analysis. These previous studies are
been used in a wide range of applications, including locating tel- valuable and can help improve the efficiency of viewshed analysis.
ecommunication relay towers (De Floriani et al., 1994), locating Graphics processing units (GPUs) have been recently used in a
wind turbines (Kidner et al., 1999), protecting endangered species large number of applications because they can provide substantial
(Camp et al., 1997), and searching for archeological locations (Lake computational power at an affordable cost, and their program-
et al., 1998). mability has also improved (Owens et al., 2007). The parallel
property of GPUs has been increasingly utilized to improve com-
*
Corresponding author. putational performance. However, traditional viewshed analysis
E-mail addresses: [email protected] (W. Feng), [email protected] (W. Gang). algorithms, which interpret the viewshed as a series of

http://dx.doi.org/10.1016/j.cageo.2014.10.012
0098-3004/& 2014 Elsevier Ltd. All rights reserved.
58 W. Feng et al. / Computers & Geosciences 75 (2015) 57–65

intervisibility calculations to all vertices of the DEM based on line- method, and this algorithm is considered more effective than the
of-sight (LOS), are mainly executed on a computer's central pro- LOS algorithm because no DEM interpolation is needed. A re-
cessing unit (CPU) without making full use of high-end GPUs. With ference plane, based on the spatial topological relation of the
the development of GPUs, some GPU-based viewshed algorithms viewpoint and the target point, is generated to calculate the visi-
have been proposed in recent three years. bility. Unlike the LOS algorithm, this method generates viewshed
The present research focuses on solving the performance issues without redundant computation. However, this technique is lim-
described above and providing users with an effective, real-time, ited to DEMs and not suited to calculating a viewshed from varying
parallel, and GPU-based viewshed analysis algorithm. This algo- resolutions.
rithm has been applied in our 3D Digital Earth application (Geo- Generally, GPUs are designed to exploit data parallelism. It has
Beans) with good results. been reported that GPUs can achieve 10 times more floating-point
operations per second (FLOPS) than CPUs (Govindaraju et al.,
2006). With the rapid development of modern GPUs, transferring
2. An overview of previous work traditional algorithms that were previously executed on CPUs to
GPUs is becoming increasingly popular. This technique enables
Viewshed analysis, as an important branch of 3D spatial ana- GPUs to process repeated computing tasks to speed up the com-
lysis, has received increasing attention among researchers. Related putation. Chen et al. (2010) implemented a rapid contour-line-
academic, conference, and research monographs regarding this extraction algorithm by using traditional methods on GPUs. Par-
approach are gradually increasing (Han, 2011). Current research allel processing techniques have also been applied to improve
mainly focuses on viewshed analyzes in terrain models whose computational performance in viewshed analyzes (Mills et al.,
data structure is a DEM or triangulated irregular network (TIN). 1992, Gao et al., 2011, Zhao et al., 2013). All these methods pro-
Other previous studies have investigated building-blocks analysis posed strategies for implementing traditional LOS-based inter-
and sunlight analysis (Ying, 2005). polation viewshed algorithm with NVIDIA CUDA. Although made a
The basic algorithm for generating a viewshed from raster progress in efficiency, those methods are limited to regular square
elevation data, known as intervisibility, is based on the estimation grids (RSGs) and not suitable for triangulated irregular networks
of the elevation difference of intermediate pixels between the (TINs), neither for complicated scene with geometry features. Fang
viewpoint and target pixels. A line segment between a viewpoint et al. (2011) introd Fang uced a real-time parallel algorithm for
O and a target point A, which makes up the LOS, is created to viewshed analysis known as shadow map-based algorithm. This
determine the visibility of target point A. Moving along the line algorithm is executed on GPUs and uses a depth buffer to store the
segment OA and testing all of the points along this line, target pixel's minimum depth. Comparing the depth of the current pixel
point A is visible only if all of the points on OA have an elevation with the depth of a corresponding pixel recorded on the depth
higher than the elevation of the corresponding point on the ter- buffer, one pixel is visible only if its depth is lower than the
rain. Otherwise, target point A is invisible from the viewpoint (see minimum depth. This method has an advantage of avoiding most
Fig. 1). The LOS computation is repeated for all target points within of the computation on a CPU and without consideration of the
the viewshed range of the viewpoint during viewshed analysis. data-structure and DEM resolution. Nevertheless, one of the dis-
This process is extremely time consuming, and its time complexity advantages of this method is its low accuracy. In Fang's method,
is expressed as O(n2). the size and depth of the shadow map determine the quality of the
The brute-force algorithm described above is simple but com- final results, and low-accuracy areas are usually visible as aliasing
putationally intense. A variety of algorithms have been developed or shadow continuity glitches.
to speed up these calculations. De Floriani et al. (1994) proposed
an algorithm, named the key slope method that is a huge im-
provement over LOS. This method continually computes the slope 3. GPU-based parallel algorithm for viewshed analysis
along the sightline and updates the maximum slope. The slope of
the current point is compared with the max slope to determine 3.1. Principle
the visibility. Unnecessary computations are greatly reduced, re-
sulting in a time complexity of O(n) using this method. A new, Our parallel algorithm takes a new approach to simulating
double increment method is presented by Yin shen to speed up viewshed analysis by creating occlusive volumes to shield the
the calculation. The accuracy, indeterminacy, and invariance of geometric features in the neighborhood of the viewpoint. In con-
viewsheds are also discussed (Ying, 2005). Liu et al. (2010) trast to the proposed GPU-based algorithm (Yanli Zhao et al.,
proposed an improved algorithm by using the slope and elevation 2013), this method avoid the interpolation operation which is time
between the target pixel and viewshed point to reduce the consuming. The surface of the geometry features is used to display
required computation. the analysis result, called the receiver. Occlusive volumes, known
Yanlan (2001) introduced a new algorithm to determine as caster, are generated according to the position of the viewpoint
viewshed without using sightline, named the reference plane and geometric feature outlines by casting the feature's outline
along the sightline to infinity. Although this process still utilizes a
sightline to generate occlusive volumes, it differs from the LOS
method because DEM interpolation is not required and calculation
redundancy is extremely reduced. All of the geometric features,
including terrain, models, and trees, in the specific space of the
required viewpoint can be used for both the caster and receiver.
Therefore, our proposed algorithm performs well in complicated
three-dimensional scenes, whereas traditional methods do not.
Users only have to add the updated feature as a new caster when
the scene is updated, and no changes to the code logic are re-
Fig. 1. Overview of the traditional LOS algorithm showing a comparison of the
height of the target point with other points along the sight line to determine the
quired. With this prerequisite, our algorithm can conveniently and
visibility. This process is computationally intense. Point B is visible from the efficiently simulate viewshed calculations by transforming this
viewpoint while point A is invisible. process to identify and label the pixels that are within the
W. Feng et al. / Computers & Geosciences 75 (2015) 57–65 59

Fig. 2. Mathematic illustration of the viewshed analysis. A stencil buffer is used to


label the areas that are in and out of the viewshed. Regions A, B and C are in the
viewshed because their stencil buffer values are larger than 0.

occlusive volume. Changing the colors of the labeled and un-


labeled pixels enables the viewshed to be displayed immediately
and clearly.
Suppose that there is a collection of geometry features in the
neighborhood of the viewpoint named O ¼{O1, O2…On}. In the
Fig. 3. Concrete process of our algorithm showing the steps executed on GPUs
stage of vertex shader, we can calculate the occlusive volumes of performed in parallel.
those features according to the viewpoint and name them V¼ {V1,
V2 … Vn}. Every point can then be rendered on the receiver, and its
amount of parallel threads, each executing an instance of the
stencil value can be changed to a label. The function F(P) is used to
kernels. In this paper, a simplified function utilizing occlusive vo-
calculate the stencil value, and the initial stencil value of P is 0.
lumes acts as kernels rather than the time-consuming two-point
After calculating the stencil value, we can distinguish the visible
intervisibility used in Yanli Zhao's method (2013). With stencil
point and invisible point with function G(P).
buffer and stencil detection, a point can be easily identified if it is
⎧ F (P) + 1, P ∈ V

⎧ visible,
⎪ F (P) = 0 within or out of an occlusive volume. More details and concrete
F (P) = ⎨ G(P) = ⎨

⎩ F (P), Otherwise ⎪
⎩invisible, F (P) > 0 steps are demonstrated in Section 3.2.3.
Our algorithm can be efficiently and easily implemented with
Fig. 2 illustrates an example of this process. There are two vertex and pixel shaders. Below is a brief introduction to our al-
geometry features, O1 and O2, and we can calculate two occlusive gorithm, and the entire process is shown in Fig. 3. Section 3.2
volumes, V1 and V2. All of the points in region A are in V1(PA∈V1), presents a detailed introduction of the concrete steps.
so F(PA) is 1. In region B, PB is in V1 and V2 (PB∈V1 and PB∈V2) and There are three steps involved in the algorithm.
F(PB) is 2. In region C, PC is in volume 2 and F(PC) is 1. With these
results, we can conclude that the points in regions A, B and C are step 1. Extract and pre-process the data; obtain all of the geo-
invisible. Other points in the terrain are visible. metric features in the scene from Digital Earth after the
In accordance with the perception of viewsheds in the real viewpoint and view range are specified. This process is
world, our algorithm can determine the viewshed based on vector independent of the data structure, and only the mesh data
data and avoid reducing accuracy by rasterizing the depth, in of the geometry features are required. DEM data analysis
contrast to the shadow map-based viewshed algorithm (Fang is the traditional algorithm and more general and useful.
et al., 2011). For DEM data, a triangle mesh can be easily generated and
By taking advantage of GPU programming, our algorithm per- used in the visualization and viewshed analysis of the
forms the sub process of two-point intervisibility in the specific original DEM data in the pre-processing stage. In this pa-
field in parallel, and this optimization process will reduce the time per, terrain data that are extracted from the Geobeans3D
consumption significantly. The proposed algorithm integrates the platform with different LOD can act as DEM data. Essen-
calculation with a rendering model that can calculate and label the tially, the extracted data should be pre-processed to en-
pixel in parallel. The GPU programming is implemented using a sure that all of the features are totally enclosed.
vertex and pixel shader, which is a set of software instructions that step 2. Generate the occlusive volumes; an occlusive volume
works on a graphics card to calculate the rendering effect with a consists of three parts: a front cap, a back cap, and the side
high degree of flexibility. The process is known as single instruc- (see Fig. 4). The occlusive volume is generated at the
tion and multiple data (SIMD), or data parallelism. Data paralle- vertex shader stage by translating the faces facing away
lism emphasizes the distributed (parallelized) nature of the data from the light a large distance along the direction of the
and not that of the processing (task parallelism). In this paper, we light. By transplanting this process onto GPUs, the occlu-
accelerate the analysis process by calculating the stencil value of sive volume can be generated in parallel and more
the point in parallel and simplify the process of two-point inter- efficiently.
visibility with the determination of points are in and out of oc- step 3. Label and generate the viewshed; in this step, the stencil
clusive volumes. Each point on the receiver acts as a data seg- buffer is used as a mask for rendering additional geometry
mentation and be sent to the stream processors to calculate and to label and distinguish the pixels that are within and
F(P) which is the specified data-parallel functions called kernels. outside of viewshed. By rendering all of the occlusive vo-
The kernels are invoked to run on GPU devices across a large lumes with a vertex extruding shader and setting up the
60 W. Feng et al. / Computers & Geosciences 75 (2015) 57–65

Fig. 4. Introduction of occlusive volume generation extends the back cap of mesh by a large distance along the line of sight. The red line indicates the back cap and the green
line indicates the front cap. The occlusive volume must be enclosed. The orange line indicates the broadside. (For interpretation of the references to color in this figure
legend, the reader is referred to the web version of this article.)

stencil buffer according to whether the pixels are within silhouette for a long distance along the direction from which the
the occlusive volume, the viewshed is finally, successfully light originates. These methods are typically conducted using CPUs
labeled. Eventually, the viewshed can be displayed in the and have proven inefficient and time consuming. Therefore, in-
complicated scene by flushing the screen and changing stead of determining the silhouette and generating the occlusive
the color according to the value of the stencil buffer. volume geometry on the CPU, our algorithm first generates a mesh
that represents the occlusive volume regardless of light direction
and uses a vertex shader to preform vertex extrusion.
3.2. Algorithm implementation The underlying concept is that triangles that face the light can
be used as-is for the front cap of the occlusive volume. The vertices
3.2.1. Data extraction and preprocessing of triangles that face away from the light are translated a large
Three-dimensional Digital Earth is a complex system for si- distance, usually to the far plane of the frustum, along the light
mulating real-world geospatial data using terrain, images, and all direction at each vertex; they can then be used as the back cap.
types of geometric features such as buildings and forest models. However, a problem occurs at silhouette edges where one triangle
The methods of terrain construction can be divided into regular- faces the light and its neighbor faces away from the light. In this
grid, TIN, and mixed grid-TIN. The regular-grid, which is easier for situation, the geometry mesh will split when performing vertex
spatial analyzes and calculations and has a small storage capacity, extrusion.
is more suitable for flat areas. However, precision is poor when the An effective way of solving this issue is duplicating the shared
regular-grid is used to stimulate mountainous areas. In contrast, vertices for the two triangles that share an edge, so that each
TIN expresses the surface morphology more precisely, especially in triangle has its own unique three vertices, and attaching a de-
complicated areas. Although it easily expresses topological re- generated quad to each shared edge. When the common edge
lationships, TIN has the disadvantages of large storage capacity between the triangles becomes the silhouette edge, one triangle
and complicated computation. There are various methods for stays where it is and the other moves along the light direction.
viewshed calculation according to different data structures, which This process, however, creates a gap between the two triangles,
differ in their output and cost. whereas a closed occlusive volume cannot have any gap or hole.
The 3D Digital Earth platform GeoBeans3D contains global and This problem can be fixed by adding a degenerated quad to the
multi-resolution terrain data. Level of detail (LOD) is used to occlusive volume between the original two triangles, thereby
render terrain in real time to improve efficiency. To process the creating two new triangles. Fig. 5 illustrates this process.
viewshed analysis in complicated scenes, the first step is to collect There are concrete steps:
geometric features and terrain in the neighborhood of the view-
point. In our algorithm, the terrain data, whose data structures  Duplicate the vertices of the original mesh and make sure every
correspond to the rendering model, are extracted in three different triangle has its own unique three vertices and edges for vertex
resolutions. This process allows the original mesh data of com- extrusion.
plicated features, such as building models, to be used in our al-  The normals of the new vertices are computed to be the normal
gorithm directly. To reduce computation, we can simplify certain of the new face. This step is necessary because the normal of
tree models using the bounding box for a given tree model. the vertex is used to determine whether the vertices should be
extruded. We refer to the vector of the current vertex to
3.2.2. Generation of occlusive volume viewpoint as L. If the dot value of vertex normal and L is less
The traditional approaches to generating occlusive volume are than 0, the vertex must be extruded.
usually two-step processes that determine the silhouette edges of  The three edges of a triangle are added to an edge-mapping
the geometric features according to the viewpoint and extend the table. An edge-mapping entry contains the vertex information

Fig. 5. Detailed illustration of mesh pre-processing, duplicating the mesh vertex, and filling in the gap by regenerating new triangles with the original four vertices.
W. Feng et al. / Computers & Geosciences 75 (2015) 57–65 61

Fig. 6. Initial steps in fixing the hole of the original mesh.

of an edge. For each edge of the added face, the algorithm looks
through the edge mapping table to find the entry of the source
edge. If the target is hit, four vertices are elicited to generate
two triangles by connecting the vertices with a specific se-
quence (clockwise in DirectX 9.0). The new triangles will be
added to the original mesh as new elements. Finally, the edge-
mapping entry should be removed from the table.
 After step 3, if there are edges in the mapping table, which
means the edges are not shared in the original mesh, we must
patch the volume because it should be closed. The existence of
these edges implies the original mesh has holes in it. The
patching algorithm examines the mapping table and identifies
two edges that share a vertex in the original mesh. Then, the
algorithm patches the hole by generating three new vertices
and a new triangle using the two neighboring edges' vertices.
Fig. 7. The process of labeling the pixel using the stencil buffer. After the process,
To connect the patched face with the mesh, two degenerated
pixel O is visible because its stencil value is equal to 0, whereas P is invisible be-
quads should be generated. This process is illustrated in Fig. 6. cause its value is not equal to 0. This process is executed on GPUs in parallel.

the neighboring space of the viewpoint is reassigned. The area in


3.2.3. Labeling and generation of the viewshed which the stencil value is not equal to 0 is the region that is
The stencil buffer can store an unsigned integral value for each shielded by the occlusive volume; this is the area that is invisible
pixel on the screen, which is frequently used as a mask to render from the viewpoint.
more dynamic effects, such as shadow and swipe. In the process of
rendering, a specific reference value can be compared with this
stencil value. The result of the comparison can indicate whether to 4. Results and discussion
update the color of the corresponding pixel. This process is called
stencil testing. The stencil value resets according to whether the This algorithm, implemented with DirectX 9.0c and C#, was
pixels are in the occlusive volume in the first render pass. Then, applied in a 3D Digital Earth application (GeoBeans3D). Geo-
the stencil test is conducted in the second render pass. If the test Beans3D is constructed from a multi-stage global DEM using
passes, the value of the corresponding pixel will be updated dy- massive satellite data. This interactive program is the largest 3D
namically; otherwise, the value will not be updated. GIS on the network in China and has been used in many important
After being created, all of the occlusive volumes are rendered in government departments. The DEM data used in GeoBeans3D
the rendering pipeline, and the pixels that are within any occlusive have a spatial resolution of 30 m globally and a local resolution of
volume are labeled in the stencil buffer. Without any extra com- 6 m. The resolution of the image data is 2.5 m nationwide and
putation, this process can be performed within the programmable, 0.6 m in some specific areas. The scale of the fundamental geo-
3D visualization pipeline by setting and updating the corre- graphic data is 1:1,000,000 globally, 1:250,000 nationwide, and
sponding render state. The implementation of this process is 1:2000 in some specific areas. As a dynamic, real-time process, the
performed in the pixel shader. The following is a detailed in- generation of viewsheds is integrated with the visualization of
troduction to this process: geometric features in GeoBeans3D. Fig. 8 provides screenshots of
the application. The viewshed is efficiently generated after the
 Clear the stencil buffer and set the value as default. Disable viewpoint is identified. Note that the area marked with green color
depth-buffer and frame-buffer writing and enable depth test- can be seen from the viewpoint, and the area marked with red
ing and stencil testing. Prepare the stencil buffer render states color cannot.
for rendering the occlusive volume. The shadow map-based algorithm and our algorithm have been
 Look through all the occlusive volumes. First, use front-face tested on three personal computers with different configurations
culling and set the stencil operation to increment on depth fail; (Table 1). The capability of the CPU of the testing computers does
then, render the back face of the occlusive volume. not make a substantial difference, but the graphics card varies
 Use back-face culling and set the stencil operation to decre- markedly. With regard to GPU performance, the graphic card in
ment on depth fail; then, render the occlusive volumes. No. 1 is best and that in No. 3 is the worst. In the experiment, we
 Recover the render states and render the whole screen. Overlay use the interactive frame-rate of the application as the evaluation
the region whose stencil value equals 0 with red, otherwise parameter. The rate is measured with Fraps3.1.0. Tested at the
with green. same region with the same viewpoint and range, the two algo-
rithms both have the best performance using No. 1 and the worst
Fig. 7 illustrates an instance of labeling with a stencil buffer. performance using No. 3 (Table 2), which means that the cap-
After all the occlusive volumes are rendered, the stencil buffer of ability of the GPU is an important issue influencing efficiency, as
62 W. Feng et al. / Computers & Geosciences 75 (2015) 57–65

Fig. 8. Screenshots of the viewshed analysis in GeoBeans3D. The red area is invisible, and the green area is visible from the viewpoint. (a and b) The viewpoint is identified
on the plateau with rich topography; (c) the viewshed with complicated features from a viewpoint over a flat plain. (For interpretation of the references to color in this figure,
the reader is referred to the web version of this article.)

Table 1
The detailed configuration of our testing platform.

No. 1 No. 2 No. 3

CPU Intel Core2 Q6600 Intel Core2 Quad Intel Core2 Duo
CPU frequency (GHz) 2.4 2.5 2.4
RAM (GB) 3.25 3.25 2
GPU NVIDIA GTX280 NVIDIA GF9800 NVIDIA GF8600
GPU memory 1 GB 1 GB 256 MB

Table 2
Testing two viewshed algorithms on our platforms.

PC No. 1 No. 2 No. 3


Fig. 9. Average time consumption of the viewshed analysis using five algorithms.
Shadow map-based algorithm (ms) 8.4 16 36.3 A3, A4 and A5 are executed on GPUs and their time consumption grows more
Our algorithm (ms) 5.2 12 20.5 smoothly with the increase of terrain data. A5 showed the best performance in
time complexity.

Table 3
same PC, we observed that our algorithm can improve the per-
Testing five viewshed algorithms in GeoBeans3D in the same platform (No. 1).
formance by an average of 35.3%.
Algorithms A1 (ms) A2 (ms) A3 (ms) A4 (ms) A5 (ms) Additionally, we conducted other experiments to further ana-
lyze the performance of viewshed analysis algorithms. Five dif-
LOD 1 0.97 0.64 0.74 0.69 0.42
ferent viewshed analysis algorithms, including an LOS algorithm
LOD 2 1.84 1.41 0.89 0.76 0.48
LOD 3 4.56 3.24 1.06 0.83 0.55
referred to as the double increment algorithm, a reference plane
algorithm, a GPU-based parallel algorithm (Yanli Zhao et al., 2013),
the shadow map-based algorithm, and our algorithm, were tested
they are both mainly composed of processes involving vertex and on computer No. 1 with the same configuration. A1 through A5
pixel shaders on GPUs. Therefore, we believe that a high-perfor- represent the five algorithms accordingly. The sample data in our
mance graphic card will accelerate the viewshed analysis algo- experiment were extracted from GeoBeans3D at three levels of
rithms (including our algorithm) when performed on GPUs. LOD. The terrain resolution is 6 m in LOD1, 2.5 m in LOD2, and
Comparing the performance of the two algorithms run on the 0.6 m in LOD3. For each level, twenty groups of viewpoints and
W. Feng et al. / Computers & Geosciences 75 (2015) 57–65 63

Fig. 10. Frame-rate with different viewpoint altitudes and ranges: (a) viewpoint altitude ¼ 215 m, range¼ 5000 m, frame-rate¼60 fps; and (b) viewpoint altitude ¼123 m,
range¼ 2500 m, frame-rate¼59 fps.

view ranges are randomly chosen as the experimental data, which algorithm. In these methods, the process of viewshed generation is
are tested using the five algorithms. After the computation time is integrated into the render pipeline and DEM interpolation is not
calculated, we calculate the average (Table 3). As shown in Table 3 necessary. Thus, the algorithms are able to maintain a consistent
and Fig. 9, the viewshed analysis algorithms executed on GPUs frame-rate when the viewpoint and view range are changed and
have a better performance than those processed on CPUs. The time additional geometric features are added to the scene. By contrast,
consumption in the five algorithms increases with the terrain re- applications using the traditional algorithms usually have a pre-
solution. However, algorithms executed on GPUs have much less cision loss in frame-rate because most of the processor cores are
slope in Fig. 9. Our viewshed analysis algorithm performed best used to interpolate the DEM terrain rather than render the whole
among the five algorithms tested. scene. However, in our algorithm, rendering the scene is the main
Generally, the time consumption of viewshed analysis increases operation, and the viewshed computation has been combined
with the view range because the larger range incorporates more with this operation; thus, changing the input parameters does not
terrain data and geometry features. However, this scenario has affect the efficiency of viewshed generation. The only process re-
little effect on the shadow map-based algorithm and our quired in our algorithm is to change the position value of the
64 W. Feng et al. / Computers & Geosciences 75 (2015) 57–65

Fig. 11. Comparison of two-point intervisibility and our proposed method. The two lines under the white line are generated using the method of two-point intervisibility.
The green segment of the line is visible, and the red segment is invisible. The results of two-point intervisibility and our method show a consistent match. (For interpretation
of the references to color in this figure legend, the reader is referred to the web version of this article.)

Fig. 12. Illustration of future improvements to our method: (a) indicates the original geometry features and their occlusive volumes; (b) using a culling algorithm to exclude
feature O1, O2, O3 whose occlusive volume is totally included by others; and (c) avoid unnecessary rendering by clamping the limits of the occlusive volume.

viewpoint transmitted into the vertex shader. In Fig. 10, we can method keeps the same with result using two-point intervisibility.
observe that the frame-rate of the application is consistent and Thus, the proposed algorithm is shown to have the same accuracy
stable. The frame-rate remains at a value of approximately 60 as the traditional DEM interpolation algorithm, which is only in-
when we halve the view range and change the altitude of the fluenced by the terrain resolution.
viewpoint. Although the experiment proves that our algorithm can greatly
The performance of an algorithm can be measured based on improve the efficiency and accuracy in the generation of view-
two aspects: efficiency and accuracy. The experimental results sheds, work must still be done to improve its efficiency. Microsoft
above indicate that the proposed algorithm can greatly improve DirectX 11 has increased primitive tessellation in the program-
the efficiency, and additional experiments should be performed to mable rendering pipeline, which enables users to generate new
demonstrate the accuracy of our algorithm. In Section 2, we in- primitives and vertices according to their needs. Therefore, we can
dicated that a flaw of the shadow map-based algorithm is its low transplant the duplication of vertices in the original mesh from the
accuracy. The depth buffer used to store the minimum depth has a
CPU to GPU and process it in parallel with the help of the geo-
maximum resolution of 4096  4096. The shadow map-based al-
metry shader to further improve the efficiency.
gorithm rasterizes the point before identifying its intervisibility.
Applicable for viewshed analyzes in complicated scenes, our
Consequently, the results are visible as aliasing, and their qualifi-
algorithm is a batch-generating process that calculates the view-
cation worsens with increasing view range. Our proposed algo-
shed for all features in the neighboring space of the viewpoint. It is
rithm avoids this flaw by creating an occlusive volume as vector
easy to handle cases in which the geometric features must be
data to identify the intervisibility. The accuracy of our algorithm is
updated by inserting them into and removing them from the
only limited to the original mesh data or DEM as a traditional DEM
feature list. However, as geometric features in the complicated
algorithm, and it will not show a reduction in accuracy at any
scene increase, it is extremely challenging to simulate viewshed
process stage in our algorithm. For the Geobeans3D platform, two-
point intervisibility is utilized, and DEM interpolation is performed analysis, which is reflected in two aspects. First, too many features
to verify the accuracy of our experimental results (Fig. 11). must be rendered and rasterized. The overlapping areas will pro-
Random points A and B with the same view point in our al- duce redundant computations when there are multiple occlusive
gorithm are chosen for two-point intervisibility. The height of the volume objects. Second, because occlusive volumes extend away
view point is 258 m. By overlapping the results, the visible and from casters toward the far plane of the view frustum, they
invisible areas of the two experiments are consistently matched in sometimes cover much of the screen. Therefore, the rasterization
every perspective. That is to say all the points along the result line of occlusive volumes is very expensive. This condition is illustrated
of two-point intervisibility have the same visibility with the result in Fig. 12. However, in the future, we can use a volume-culling
calculated with this proposed method. The points marked with algorithm to eliminate the casters to solve the first issue. To ad-
flag in Fig. 11 are the specialized case. Their visibility using our dress the second issue, we can clamp the extents of the occlusive
W. Feng et al. / Computers & Geosciences 75 (2015) 57–65 65

volume to avoid unnecessary rendering in the large regions of References


empty spaces.
Mills, K., et al., 1992. Implementing an intervisibility analysis model on a parallel
computing system. Comput. Geosci. 18 (8), 1047–1054.
De Floriani, L., et al., 1994. Line-of-sight communication on terrain models. Int. J.
5. Conclusions Geogr. Inf. Syst. 8 (4), 329–342.
Camp, R.J., et al., 1997. Viewsheds: a complementary management approach to
Large quantities of computing resources are required to buffer zones. Wildl. Soc. Bull. 25 (3), 612–615.
Lake, I.R., et al., 1998. Modelling environmental influences on property prices in an
seamlessly render global multi-resolution terrain in virtual 3D urban environment. Comput. Environ. Urban Syst. 22 (2), 121–136.
environments and geometric features on the ground. Therefore, Kidner, D., et al., 1999. GIS and Wind Farm Planning. Geographical Information
optimizing the efficiency of rendering programs is an important and Planning. Springer, Advances in Spatial Science, pp. 203–223. http://link.
springer.com/chapter/10.1007%2F978-3-662-03954-0_11.
task for application developers. The introduction of a GPU to the
Chen, Z., et al., 2010. Parallel algorithm for real-time contouring from grid DEM on
terrain analysis in Digital Earth can effectively accelerate the tra- modern GPUs. Sci. China Technol. Sci. 53, 33–37.
ditional method through parallelization. Fang, C., et al., 2011. Parallel algorithm for viewshed analysis on a modern GPU. Int.
This paper introduces a rapid and efficient algorithm based on J. Digit. Earth 4 (6), 471–486. http://dx.doi.org/10.1080/17538947.2011.555565.
Gao, Y., et al. 2011. Optimization for viewshed analysis on GPU. Geoinformatics,
a GPU to achieve rapid viewshed analysis of scenes with structures 2011, In: Proceedings of the IEEE 19th International Conference.
and vegetation. The algorithm has been used in GeoBeans3D and Govindaraju, N., et al. 2006. GPUTeraSort: high performance graphics co-processor
has potential applications in many projects. Tests have proven that sorting for large database management. In: Proceedings of the 2006 ACM
SIGMOD International Conference on Management of Data, pp. 325–336.
our algorithm can effectively overcome the bottlenecks that tra- Han, J., 2011. Research on space visibility analysis in 3D simulation [D], He nan:
ditional algorithms face and achieve viewshed rendering from the Information Engineering University.
perspective of real-life geographic phenomena, which is practi- Liu, L., et al., 2010. An improved line-of-sight method for visibility analysis in 3D
complex landscapes. Sci. China Inf. Sci. 53 (11), 2185–2194.
cally important. The algorithm presented here improves the ac- Owens, J.D., et al., 2007. A survey of general-purpose computation on graphics
curacy of viewshed rendering while also improving its efficiency. hardware. Comput. Graph. Forum 26 (1), 80–113.
Moreover, with its extensive potential expandability, this algo- Shi, J.-S., Liu, J.-Z., 2005. Development of 3 DGIS technology. Cehui Kexue/Sci. Surv.
Mapp. 30 (5), 117–119.
rithm applies to multi-source and multi-resolution heterogeneous
Yanlan, W., 2001. An algorithm computing viewsheds based on reference planes.
data and exhibits great practical value for 3D GIS applications. Wtusm Bull. Sci. Technol. 1, 006.
Ying, S., 2005. Key techniques and applications of spatial visibility analysis [D], Hu
bei: Wu han University.
Zhao, Y.L., et al., 2013. A parallel computing approach to viewshed analysis of large
Acknowledgments terrain data using graphics processing units. Int. J. Geogr. Inf. Sci. 27 (2),
363–384. http://dx.doi.org/10.1080/13658816.2012.692372.
Zhou, Q.M., Liu, X.J., 2006. Digital Terrain Analysis. Science Press, Beijing, BJ, pp.
The authors gratefully acknowledge every member in the 3D 181–200.
Group (GeoBeans Co., Ltd.) for providing useful help. The authors
are also grateful for the helpful comments provided by Dr. Chen
Yun from the Australia Commonwealth Science Industries Re-
search Organization. This work was supported in part by 863
Program Grants 2012AA12A401 and 2013AA12A403.

You might also like