Mapping Toolbox | ![]() ![]() |
Mapped Light Objects
The Mapping Toolbox allows for the mapping of light objects using the lightm
command, which is similar to the light
command in MATLAB. Here, place a lighted source at an infinite distance, representing the Sun at the summer solstice (23.5°N) at local apparent noon in Natick, Massachusetts (71°W):
load topo ptopo = topo; ptopo(topo<0) = 0; ptopo = 100*ptopo/(almanac('earth','radius')*1000); axesm globe; view([15 38]) meshm(topo,topolegend,size(topo),ptopo); demcmap(topo) shading interp lightm(23.5,-71,'Color','y') material([.5 .7 1.5]); lighting phong
The topo
surface had been modified to show the 3-D features of land only, which is vertically exaggerated by a factor of 100. The ocean depths are shown by color only.
As a comparison to the lighted shaded relief example shown earlier, add a light source to the surface colored matrix map of the Korean peninsula region shown earlier:
figure; load korea axesm('MapProjection','eqaconic','MapParallels',[],... 'MapLatLimit',[30 45],'MapLonLimit',[115 135]) meshm(map,maplegend,size(map),map); demcmap(map) light('Position',[1 0 1]) material([.5 .5 1]); lighting phong daspectm('meters',125) view(0,75)
The light effects employed here are different and separate from those used by surfm
, meshlsrm
, and surflsrm
. Here, a light object is added directly to the map surface. Like all displayed surfaces, the light object is a separate MATLAB graphic object with its own object handle. For the functions meshlsrm
and surflsrm
, light effects are simulated within the functions by modifying the colormap with bands of light and dark. The map matrix is then converted to indices for the new "shaded" colormap based on calculated surface normals. Using light objects allows for a wide range of different light effects, such as ambient light, light color, and surface reflectance properties.
For more information, consult the reference pages for meshlsrm
, surflsrm
, and lightm
in the online Mapping Toolbox reference documentation, along with the section on lighting in the MATLAB graphics documentation.
![]() | Data Representation | Draping Data on Elevation Maps | ![]() |