({{, (RefLink[OpacityFunction, paclet:ref/OpacityFunction]) 
is an option for graphics functions that specifies a function to apply to determine opacity of elements.}})

OpenersNotesSection(Spacer1)Details

With OpacityFunction->func, the arguments supplied to func are as follows:

Typical settings for (RefLink[OpacityFunction, paclet:ref/OpacityFunction]) include:

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

The (RefLink[Automatic, paclet:ref/Automatic]) setting attempts to create approximately 80% transparency in the volume:

DensityPlot3D[x^2+y^2+z^2,{x,-2,2},{y,-2,2},{z,-2,2},OpacityFunction->Automatic,PlotLegends->Automatic]

Use (RefLink[None, paclet:ref/None]) to get a fully opaque visualization:

DensityPlot3D[Sin[π x]Sin[π (y+z)],{x,-2,2},{y,-2,2},{z,-2,2},OpacityFunction->None]

Set opacity as a function (((1-f))^2) of the scaled function value f:

DensityPlot3D[x y z,{x,-1,1},{y,-1,1},{z,-1,1},OpacityFunction->Function[f,(1-f)^2]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[OpacityFunctionScaling, paclet:ref/OpacityFunctionScaling])  ▪  (RefLink[ColorFunction, paclet:ref/ColorFunction])  ▪  (RefLink[DensityPlot3D, paclet:ref/DensityPlot3D])  ▪  (RefLink[ListDensityPlot3D, paclet:ref/ListDensityPlot3D])}})}})