[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.4.4 Surface transparency
MathGL library has advanced features for setting and handling the surface transparency. The simplest way to add transparency is the using of function Alpha()
. As a result, all further surfaces (and isosurfaces, density plots and so on) become transparent. However, their look can be additionally improved.
First, the selected surface will be non-transparent if one sets the flag Transparent
before the surface drawing and sets it off after the drawing.
Second, the value of transparency can be different from surface to surface. To do it just change the value of AlphaDef
before the drawing of the selected surface. If its value is close to 0 then the surface becomes more and more transparent. Contrary, if its value is close to 1 then the surface becomes practically non-transparent. This is some analogue of Transparent=true
.
Third feature is the changing of the way how the light goes through overlapped surfaces. The variable TranspType
defines it. By default the usual transparency is used (TranspType=0
) – surfaces below is less visible than the upper ones. A “glass-like” transparency (TranspType=1
) has a different look when the surface just decreases the background light (the surfaces are commutable in this case).
A “neon-like” transparency (TranspType=2
) has more interesting look. In this case a surface is the light source (like a lamp on the dark background) and just adds some intensity to the color. At this, the library sets automatically the black color for the background and changes the default line color to white.
As example I shall show the variant of plot from Plots for 2D data (grid drawing is disabled) for different types of transparency.
Example of TranspType=0
.
Example of TranspType=1
.
Example of TranspType=2
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |