3-D Visualization Previous page   Next Page

Mapping Data to Transparency -- Alpha Data

Alpha data is analogous to color data (e.g., the CData property of surfaces). When you create a surface, MATLAB maps each element in the color data array to a color in the colormap. Similarly, each element in the alpha data maps to a transparency value in the alphamap.

Specify surface and image alpha data with the AlphaData property. For patch objects, use the FaceVertexAlphaData property.

You can control how MATLAB interprets alpha data with the following properties:

Note that there are differences between the default values of equivalent color and alpha properties because, in contrast to color, transparency is not displayed by default. The following table highlights these differences.

Color Property
Default
Alpha Property
Default
FaceColor
Flat
FaceAlpha
1 (opaque)
CData
Equal to ZData
AlphaData and FaceVertexAlphaData
1 (scalar)

By default, objects have single-valued alpha data. Therefore you cannot specify flat or interp FaceAlpha or EdgeAlpha without first setting AlphaData to an array of the appropriate size.

The sections that follow illustrate how to use these properties to display object data as degrees of transparency.

Size of the Alpha Data Array

In order to use nonscalar alpha data, you need to specify the alpha data as an array equal in size to

Once you have specified an alpha data array of the proper size, you can select the face and edge rendering you want to use. Flat uses one transparency value per face, while interpolated performs bilinear interpolation of the values at each vertex.

Mapping Alpha Data to the Alphamap

You can control how MATLAB maps the alpha data to the alphamap using the AlphaDataMapping property. There are three possible mappings:

By default, objects have scalar alpha data (AlphaData and FaceVertexAlphaData) set to the value 1.


Previous page  Specifying a Single Transparency Value Example -- Mapping Data to Color or Transparency Next page

© 1994-2005 The MathWorks, Inc.