Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have seen a few DEM/hillshades in published journal articles that use a phong lighting scheme which gives surfaces a metallic luster. Does anyone know how/if this can be achieved in arcmap?

share|improve this question
add comment

1 Answer

Yes, it can.

Phong shading is a sum of ambient, diffuse, and (specularly) reflected light.

  1. The ambient portion is represented by the usual map of the DEM.

  2. The diffuse portion is computed with a hillshade. A "hillshaded DEM" is a weighted sum of ambient and diffuse reflections.

  3. The formula for the reflected part of the image can be computed in terms of (i) the direction to the light source (sun), given in terms of its azimuth s_a (degrees east of north) and "elevation" s_e (degrees up from the horizon), (ii) the direction to the viewer, which in a map is always taken to be straight up, (iii) the slope and aspect at each point.

ArcGIS computes hillshades and allows semi-transparent overlays, which is tantamount to forming a positive linear combination of images. Thus the only novelty is to compute the reflection map (3). Spatial Analyst (part of ArcGIS) computes aspect grids (again in degrees east of north) and slope grids (in degrees). The specular reflection therefore can be computed from these grids using raster calculations ("map algebra") according to the Phong shading formula.

The formula requires the component of the reflected light reaching the observer to be raised to a positive power alpha (which determines the "shininess"; the larger it is, the more point-like the reflections become). To find this component we do a small amount of 3D analytic geometry and conversion between spherical and Cartesian coordinates:

  • A unit vector in the sun's direction is S = (sin(s_a)sin(s_e), cos(s_a)sin(s_e), cos(s_e)).

  • A unit vector normal to the surface (which varies from cell to cell and therefore is given by three grids of coordinates) is N = (sin(aspect)sin(slope), cos(aspect)sin(slope), cos(slope)).

  • A unit vector in the reflected direction therefore is R = 2<N, S> N - S. (<,> is the usual dot product.)

  • The component of the reflection in the viewer's direction (V = (0,0,1)); namely, <R, V>, is simply the z-coordinate of R. Thus, in the preceding step, you need only compute the third coordinate of the linear combination, not all three coordinates.

By raising this last grid to the alpha power you will have computed the specular component of the reflection (up to a multiple determined by the sun's intensity). That multiple can be set in terms of the transparency parameter in the grid's display. To show the Phong shaded map you will display the three grids--a good order is hillshade, DEM, reflection--with appropriate transparency settings to balance the diffuse, ambient, and specular portions, respectively.

The terminology here--R, N, V, and alpha--is the same as that used in the Wikipedia article.

share|improve this answer
    
+1 great explanation. Do these shiny maps let us position sun at its true location without producing an optical illusion of inverted mountains? (I've heard that re-positioning the sun is an acceptable lie when when hill shading). –  Kirk Kuykendall Mar 21 '11 at 13:48
    
@Kirk I suspect the reflections might not supply enough of a visual cue to override how we process the hillshade. You bring out an important point: for a physically realistic result, use the same azimuth and elevation for the hillshade and the reflection. (I suspect that using disparate directions would make it look like there are two separate lights.) –  whuber Mar 21 '11 at 14:00
    
thanks for the explanation. I gave it a try and ended up with an R3 grid that looked like a rice bowl. Not sure exactly where I went wrong but maybe its my conversion to spherical coordinates. I am right in assuming that s_e and aspect should be converted from clockwise-from-north, to counter-clockwise-from-east? e.g. default hillshade sun angle is 315, 45 (CW from N), should this be converted to 225, 45 (CCW from E)? –  Gabriele Casale Mar 21 '11 at 21:05
    
@Gabriele Make sure you and ArcGIS agree about the units of angular measure. ArcGIS computes aspects and slopes in degrees but the sin and tan functions typically expect angles in radians. Yes, I provided formulas for angles CW from north (rather than the mathematical/physical/engineering convention of CCW from east). –  whuber Mar 21 '11 at 21:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.