Opacity

Opacity[a]

is a graphics directive that specifies that graphical objects that follow are to be displayed, if possible, with opacity a.

Opacity[a,color]

uses the specified color with opacity a.

Details

  • Opacity runs from 0 to 1, with 0 representing perfect transparency.
  • If an opacity-a object with color c1 is placed in front of an object with color c2, the resulting color will be the blend ac1+(1-a)c2.
  • If red and blue with opacity 0.5 are combined, the result is purplenot black, as it would be with physical monochromatic filters. »
  • Opacity works in both 2D and 3D graphics.
  • It may take significantly longer to render 3D graphics that involve transparent surfaces.
  • Graphics that involve transparency may need to be printed as highresolution bitmaps.
  • On many computer systems, objects with opacity a will appear completely transparent if a is too small. »

Examples

open allclose all

Basic Examples  (3)

Make a 50% transparent sphere:

Plot a see-through surface:

Overlapping translucent 2D disks:

Scope  (3)

Larger opacity makes surfaces more opaque:

Opacity is kept throughout the scope of graphics directives:

Color primitives can be used with Opacity:

Generalizations & Extensions  (1)

Directive can be used to combine colors with opacity:

Applications  (3)

Half-transparent surface:

Use Opacity to understand complicated surfaces:

Use Opacity to visualize internal structure, in this case two ellipsoidal shells:

Properties & Relations  (7)

Overlapping of translucent red and blue disks results in purple:

Background color can be seen through a transparent object:

Opacity plus color can also be specified using the optional final parameter of various color directives:

Each color primitive supports an extended form that can be used to specify opacity:

Opacity is used by default to show overlapping fillings:

Opacity is used for fillings to surface plots:

Opacity is used in ParametricPlot to visualize regions that get covered multiple times:

Possible Issues  (5)

If the opacity is too small, objects will typically render as completely transparent:

Overlapping of multiple translucent objects can generate an opaque result:

If each opacity is too small, any number of elements together will still render as transparent:

Completely transparent objects are still counted for PlotRange:

The two-argument form of Opacity might be partially modified by subsequent directives:

The default rendering of opacity may clip objects that are behind too many other objects in 3D graphics:

Rendering can be improved by increasing the depth peeling layers with RenderingOptions:

Alternatively, the graphic can be rendered using a BSP tree, which is slower but has no layer limit:

Neat Examples  (1)

Random collection of transparent cylinders:

Wolfram Research (2007), Opacity, Wolfram Language function, https://reference.wolfram.com/language/ref/Opacity.html.

Text

Wolfram Research (2007), Opacity, Wolfram Language function, https://reference.wolfram.com/language/ref/Opacity.html.

CMS

Wolfram Language. 2007. "Opacity." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Opacity.html.

APA

Wolfram Language. (2007). Opacity. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Opacity.html

BibTeX

@misc{reference.wolfram_2024_opacity, author="Wolfram Research", title="{Opacity}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Opacity.html}", note=[Accessed: 23-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_opacity, organization={Wolfram Research}, title={Opacity}, year={2007}, url={https://reference.wolfram.com/language/ref/Opacity.html}, note=[Accessed: 23-November-2024 ]}