# Functional Opacity in VectorPlot3D

I am trying to plot a vector graph such that that vectors closest to the origin are opaque, and those furthest from the origin are transparent. I have tried using opacity with a function inside of it:

VectorPlot3D[1/(1 + Sqrt[x^2 + y^2 + z^2])
HeavisideTheta[
z - 3/2 (1/10) (x^2 + y^2)]*{1/
3 E^-z (-(1/2) Sqrt Sin[(Sqrt x)/2 - y/2] -
1/2 Sqrt Sin[(Sqrt x)/2 + y/2]),
1/3 E^-z (1/2 Sin[(Sqrt x)/2 - y/2] -
1/2 Sin[(Sqrt x)/2 + y/2] - Sin[y]), -(1/3)
E^-z (Cos[(Sqrt x)/2 - y/2] + Cos[(Sqrt x)/2 + y/2] +
Cos[y])} + 1/(1 + Sqrt[x^2 + y^2 + z^2])
HeavisideTheta[
3/2 (1/10) (x^2 + y^2) - z]*{-(1/3) E^
z (-(1/2) Sqrt Sin[(Sqrt x)/2 - y/2] -
1/2 Sqrt Sin[(Sqrt x)/2 + y/2]), -(1/3) E^
z (1/2 Sin[(Sqrt x)/2 - y/2] - 1/2 Sin[(Sqrt x)/2 + y/2] -
Sin[y]), -(1/3) E^
z (Cos[(Sqrt x)/2 - y/2] + Cos[(Sqrt x)/2 + y/2] +
Cos[y])}, {x, -1 \[Pi], 1 \[Pi]}, {y, -1.5 \[Pi], 1.5 \[Pi]}, {z, -2, 1.5}, VectorStyle -> {Black, Opacity[Function[{x,y,z},1/(1+x*y*z)]}, Axes -> True, AxesOrigin -> {0, 0, 0}, Boxed -> False, VectorPoints -> 10, ImageSize -> Large, VectorScale -> 0.04, ViewPoint -> Front]


As well as using the GrayLevel function to try and create functional dependence to just make the outer vectors more grey.

Neither of these approaches seem to be working.

VectorPlot3D[1/(1 + Sqrt[x^2 + y^2 + z^2])
HeavisideTheta[
z - 3/2 (1/10) (x^2 + y^2)]*{1/
3 E^-z (-(1/2) Sqrt Sin[(Sqrt x)/2 - y/2] -
1/2 Sqrt Sin[(Sqrt x)/2 + y/2]),
1/3 E^-z (1/2 Sin[(Sqrt x)/2 - y/2] -
1/2 Sin[(Sqrt x)/2 + y/2] - Sin[y]), -(1/3)
E^-z (Cos[(Sqrt x)/2 - y/2] + Cos[(Sqrt x)/2 + y/2] +
Cos[y])} + 1/(1 + Sqrt[x^2 + y^2 + z^2])
HeavisideTheta[
3/2 (1/10) (x^2 + y^2) - z]*{-(1/3) E^
z (-(1/2) Sqrt Sin[(Sqrt x)/2 - y/2] -
1/2 Sqrt Sin[(Sqrt x)/2 + y/2]), -(1/3) E^
z (1/2 Sin[(Sqrt x)/2 - y/2] - 1/2 Sin[(Sqrt x)/2 + y/2] -
Sin[y]), -(1/3) E^
z (Cos[(Sqrt x)/2 - y/2] + Cos[(Sqrt x)/2 + y/2] +
Cos[y])}, {x, -1 \[Pi], 1 \[Pi]}, {y, -1.5 \[Pi], 1.5 \[Pi]}, {z, -2, 1.5}, VectorStyle -> {GrayLevel[Sqrt[x^2 + y^2 + z^2]], Opacity}, Axes -> True, AxesOrigin -> {0, 0, 0}, Boxed -> False, VectorPoints -> 10, ImageSize -> Large, VectorScale -> 0.04, ViewPoint -> Front]


Sorry about the lack of formatting. It got lost copying it over. Thanks in advance!

Remove the option VectorStyle and add the options VectorColorFunctionScaling -> False and VectorColorFunction -> Function[{x, y, z}, Opacity[1/(1 + x*y*z), Black]] (better yet, as suggested by MelaGo in comments Function[{x, y, z}, Opacity[1/Norm[{x,y,z}], Black]) to get • Or alternatively Opacity[1/(Norm[{x, y, z}]), Black] – MelaGo Jul 1 '19 at 4:49