ray tracing in geocomputation

27
Emerging computational techniques and technologies in GeoComputation Session 4458 © Sanjay Rana 2006 Ray Tracing in GeoComputation Sanjay Rana Department of Civil and Environmental Engineering University College London [email protected]

Upload: gale

Post on 05-Jan-2016

45 views

Category:

Documents


2 download

DESCRIPTION

Ray Tracing in GeoComputation. Sanjay Rana Department of Civil and Environmental Engineering University College London [email protected]. Topics Ray Tracing Applications in GIS Implementing Ray Casting within GIS Conclusions. Ray Tracing - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

Ray Tracing in GeoComputation

Sanjay RanaDepartment of Civil and Environmental EngineeringUniversity College [email protected]

Page 2: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

Topics1. Ray Tracing 2. Applications in GIS3. Implementing Ray Casting within GIS4. Conclusions

Page 3: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

1. Ray Tracing• Technique to trace the path of a (light) ray

through a scene and calculating the reflection, refraction, and absorption of the ray when it interacts with the objects in the scene.

Viewpoint-based Ray Tracing Light-based Ray Tracing

Page 4: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

1. Ray Tracing• Originally developed for gamma radiation related experiments.• Now mostly used in Computer Graphics for rendering

photorealistic scenes.

Three spheres that reflect off each other and the floor

Transparency and Shadow details

Page 5: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

1. Ray Tracing• Two general types of ray tracing principles:

1a. Ray Casting: A simple approach to identify objects visible from the viewpoint e.g. “Are two locations visible to each other?” Or “What is the nearest object to the viewpoint”?

1b. Radiosity, Photon Mapping etc. types:Based on the entire path a light ray travels after reflection, refraction, and absorption e.g. computation of soft shadows and transparency. Several orders more complicated than Ray Casting.

Page 6: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

1a. Ray Casting

Pseudo Code:

(i) Cast a ray starting at the viewpoint, pointing to a direction or the desired target.

(ii) Intersect ray with each objects along the ray path.

(iii) Collect nearest intersection.

(iv) For Line of Sight (LOS) test, check if the nearest intersection is on the desired target.

OR

Repeat steps (i)-(iii) for entire 360o view for creating a visibility polygon or isovist.

Visibility Polygon or Isovist

Page 7: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

1b. Radiosity, Photon mapping etc. types

Pseudo Code:

i. Create a ray at the viewpoint or light source, pointing in any direction.

ii. Intersect ray with an object.

iii. Use a rendering equation or some wave propagation model to evaluate what happens to the ray i.e. incident angles, how much reflected, absorbed etc.

iv. Repeat steps (i)-(iii) for the reflected/refracted ray and keep repeating (iv) for several runs.

v. Repeat steps (i)-(iv) for many many rays till a satisfactory solution (in case of computer graphics, photorealism) has been achieved.

Page 8: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

1. Ray Tracing• The objective of the talk is to show you some quite unique applications of

this computer graphics technique in GeoComputation.• For detailed information on ray tracing, please refer to numerous literature

on ray tracing in books, papers.

Page 9: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2. Applications in GIS

2a. Urban visibility analysis• Morphometry of open spaces• Wayfinding models

2b. Wireless reception modelling2c. Geometrical analysis of shapes

• Medial Axis Transform

Page 10: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2a. Urban visibility analysis• Intellectually challenging study of indoor and

outdoor built environments with applications ranging from accessibility evaluation, pedestrian behaviour modelling, visual surveillance, and visual impact assessment (aesthetics).

• Architecture surrounding urban open spaces is geometrically quite complex for analysis.

• Void or open space between architecture is a sort of mirror of the architecture and can be easily characterised.

Page 11: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2a.1 Morphometry of open spaces• Based on generalising the open space with a dense

mesh of viewpoints (i.e. rasterisation) and computing an isovist for each of the viewpoints by Ray Casting.

• The shape of an isovist (i.e. a spot in the open space) can be described in terms of several 2D morphological measures .

• Most commonly derived using 2D building plans and street networks.

Page 12: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2a.1 Morphometry of open spacesPseudo code:

i. Create a dense mesh of viewpoints in the open space.

ii. Cast a ray from a viewpoint in a direction and collect the nearest intersection point.

iii. Repeat step (ii) in very fine angular intervals (≤0.1o) over 360o.

iv. Join up all intersection points to form the isovist and compute shape measures.

v. Repeat steps (ii)-(iv) for all viewpoints.

Page 13: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

r d

Area: The amount of visible space.

Radial (r) and Diametric (d) length: The length of line of sight or ray from the viewpoint.

Circularity: Level of resemblance of the isovist polygon to a circle;Circularity = π.r2 / [area of isovist],r = average radial length.

2a.1 Morphometry of open spaces

Page 14: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2a.1 Morphometry of open spaces

Dense Mesh of 4298 viewpoints

Isovist Area

Longest Diametric Length

Circularity

High

LowTate Britain Gallery, London

Page 15: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2a.2 Wayfinding models• Enormous amount of multi-disciplinary research on the kind of clues in the open space, people use in deciding their path in a shopping mall, roads, hospitals and so on.• Some simple clues include: the direction with the most amount of area visible (following the light) and the direction along the furthest visible point (following the radials). Some research

also on Random Walk.• Empirical studies have been done which found weak to reasonable level of correlation between the simulated directions of movement and actual path people take.

Page 16: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2a.2 Wayfinding modelA very crude exploratory walk Pseudo Code:i. Generate a dense mesh of viewpoints in the open space.ii. Compute the direction of longest radial and longest radial length (LRL) for each viewpoint. iii. Place the observer(s) of the walk anywhere.iv. Find the viewpoint with the longest radial in the neighbourhood of the observer(s).v. Take the MRL direction of this neighbour and move the observer one step in that direction.vi. Repeat steps (iv) – (v).

Page 17: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

5-6060-150150-185185-275275-350

Direction of Longest Radials based on 5o ray intervals

12 steps of six observers exploring the polygon based on the LRL

N

Page 18: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2b. Wireless Reception modelling• Planning of Radio and Cell Phone antennas coverage

involves modelling the transmission of radio and micro waves within the urban infrastructure.

• It is basically a radiosity type ray tracing except with different equations and generally a location-allocation requirement.

• At present, wireless reception modelling is carried out with third party plug-ins, which use finite element numerical mathematics.

• There will be a rise in demand for this application due to the increasing focus on embedding Wi-Fi networks (e.g. for seamless VOIP services) and cell phone technology in cities.

Page 19: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2b. Screenshots of Wireless System Engineering (WiSE) software tool developed by Bell Laboratories

Ray Traces in WISE

Signal Strength Plot

See also: Wagen and Rizk (2003). Radiowave propagation, building databases, and GIS: anything in common? A radio engineer's viewpoint, E&P-B, 30(5), 767-787.

Page 20: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2c. Geometrical Analysis of Shapes• Understanding the shape of geographical

representations (e.g. contours, polygons) is useful in certain spatial operations (e.g. when converting contours to DEMs, finding out the road centre lines).

• At present, most solutions are based on differential geometry, utilising the variations in the coordinates of the shape outlines.

• Some of the morphometric measures derived from ray tracing are also useful and in some cases (e.g. 3D shapes) will be even more easier to compute.

Page 21: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2c.1 Medial Axis Transform (MAT)• Linking the centres of circles and spheres, which touch the

boundary of a shape at least twice.

• MAT is a popular technique to identify the “skeleton” of shapes in many disciplines ranging from medical imaging to computer graphics hence also called skeletonization.

• In GeoComputation, it has been used in detecting feature lines in contours during triangulation to avoid flat triangles (Gold and Dakowicz 2001).

Contour

Medial Axis

Flat Triangles

Correct shape after adding medial axis

Page 22: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

2c.1 Medial Axis Transform (MAT)• A trivial way to do MAT is to perform the Distance Transform,

which involves discretising the shape and computing the shortest distance from each cell/voxel to the boundary.

• The shortest distance to the boundary is in fact same as the shortest radial length derived by ray tracing.

• The cells at local extremum are skeletal points and the medial axis coincides with the ridge line.

A landscape type plot of shortest radial length. Note that the ridges coincide with the medial axis.

Page 23: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

3. Implementing Ray Casting within GIS • The run time of basic Ray Casting is O(mn), where m is the

average number of intersection tests around a viewpoint and n is the number of viewpoints. Radiosity type ray tracing will require several orders more computation time.

• Roughly, the number of intersections depends upon the number of obstacles and number of rays from the viewpoint (>> 3600).

• The software architecture in most of the existing off-the-shelf GI systems leads to extremely long computation time because of the following reasons: Scripts are interpreted and not compiled into machine

language. More efficient data structures such as graphs and trees are

not available to the developer.

Page 24: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

3. Implementing Ray Casting within GIS • Computation time of ray casting can be speeded up by several

techniques e.g. by converting the scene into Binary Space Partitioning Tree structure (BSP Tree). In short, BSP Tree divides the space by planes (l1, l2,l3, l4) into a

set of convex polygons.

From BSP tree we can find out where the viewer is placed (a very simple point-in-polygon query) and the objects in that convex polygon. So we do not have to perform intersection tests with all polygons.

l1l2

l3

l4

Page 25: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

3. Implementing Ray Casting within GIS

Demonstration of Isovist Analyst

Page 26: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

4. Conclusions• Ray Tracing is a technique for tracing the path of rays in

a 2D or 3D Scene.• Ray Tracing can be used in several types of

GeoComputation e.g. urban viewshed, wireless reception modelling and geometrical analysis of shapes.

• The simpler version of Ray Tracing, namely Ray Casting will certainly be a very useful function in existing GI Systems. It could “simply” be the “missing” 2D analogy of the terrain viewshed function e.g. the Visibility function in ArcObjects.

• The computation requirements are high but could be substantially reduced with heuristics.

Page 27: Ray Tracing in GeoComputation

Emerging computational techniques and technologies in GeoComputation

Session 4458

© Sanjay Rana 2006

AcknowledgementsDiscussions and software support:• Yiorgos Chrysanthou for the BSP code• Frank Warmerdam for Shapefile libraries.Images:• http://en.wikipedia.org/wiki/Ray_tracing• http://aec.cadalyst.com/aec/article/articleDetail.jsp?id=155714• Conroy and Dalton (1999) for the Tate Gallery outline.• http://www.bell-labs.com/org/wireless/wisext.html for WISE images• http://www.voronoi.com/pdfs/2000-2003/Terrain_Modelling_from_Contours.pdf for

MAT and Terrain modelling figures.

Isovist Analyst can be downloaded for free from:http://www.ucl.ac.uk/~ucessan/software/isovist-analyst.htm

This presentation would soon be available online at:http://eprints.ucl.ac.uk/perl/search/advanced?&creators=rana