Home‎ > ‎D) Software‎ > ‎D.A) VBA‎ > ‎

D.A.8) Terrain Ray-Tracing

Although somewhat slow it, it is possible to perform simple ray-tracing in Excel using VBA.

In this example DTED data is illuminated by a single light source of zero size (i.e., a point source). For each data point the normal to the gradient at that point is calculated via a cross product. The dot product of this normal and a vector from the light source to the data point is used to determine the shade used to fill each cell.

The image below is 1204 columns by 1544 rows and covers a chunk of the South of England having Selsey bill at the southwest corner:



The same data with a light source at low level over Slough and hidden-surface shading.


 (The line across the middle may be an artefact from the way I imported the data - i.e., with a mistake)
Comments