3-D Visualization Previous page   Next Page

Adding Lights to a Scene

This example displays the membrane surface and illuminates it with a light source emanating from the direction defined by the position vector [0 -2 1]. This vector defines a direction from the axes origin passing through the point with the coordinates 0, -2, 1. The light shines from this direction toward the axes origin.

Creating a light activates a number of lighting-related properties controlling characteristics such as the ambient light and reflectance properties of objects. It also switches to Z-buffer renderer if not already in that mode.

Illuminating Mathematical Functions

Lighting can enhance surface graphs of mathematical functions. For example, use the ezsurf command to evaluate the expression

over the region -6pi to 6pi.

Now add lighting using the lightangle command, which accepts the light position in terms of azimuth and elevation.

After obtaining the surface object's handle using findobj, you can set properties that affect how the light reflects from the surface. See Properties That Affect Lighting for more detailed descriptions of these properties.


Previous page  Light Objects Properties That Affect Lighting Next page

© 1994-2005 The MathWorks, Inc.