Colored Surface Shaded Relief

The functions meshlsrm and surflsrm display maps as shaded relief with surface coloring as well as light source shading. You can think of them as extensions to surflm that combine surface coloring and surface light shading. Use meshlsrm to display regular data grids and surflsrm to render geolocated data grids.

These two functions construct a new colormap and associated CData matrix that uses grayscales to lighten or darken a matrix component based on its calculated surface normal to a light source. While there are no analogous MATLAB® display functions that work like this, you can obtain similar results using MATLAB light objects, as Relief Mapping with Light Objects explains.

For further information, see the reference pages for surflsrm, meshlsrm, daspectm, and view.

Create Colored Shaded Relief Map

This example shows how to use surflsrm to display surface illumination over colored elevation data.

Start with a new map axes and the korea data, and then georeference the regular data grid.

load korea
[klat,klon] = meshgrat(map,refvec);

Create a colormap for DEM data; it is transformed by surflsm to shade relief according to how you specify the sun's altitude and azimuth.

[cmap,clim] = demcmap(map);

Plot the colored shaded relief map, specifying an azimuth of -135º and an altitude of 50º for the light source.

axesm('miller','MapLatLimit',[30 45],'MapLonLimit',[115 135]);
surflsrm(klat,klon,map,[-130 50],cmap,clim)

You can also achieve the same effect with meshlsrm, which operates on regular data grids (it first calls meshgrat, just as you just did), e.g., meshlsrm(map,maplegend).

The surface has more contrast than if it were not shaded, and it might help to lighten it uniformly by 25% or so.


Plot an oblique view of the surface by hiding its bounding box, exaggerating terrain relief by a factor of 50, and setting the view azimuth to -30º (south-southwest) and view altitude to 30º above the horizon:


You can continue to rotate the perspective with the view function (or interactively with the Rotate 3D tool in the figure window), and to change the vertical exaggeration with the daspectm function. You cannot change the built-in lighting direction without generating a new view using surflsrm.