Weird lighting for spherical plot

Consider the following code :

\[HBar]\[Omega] = 1;

EXIni[p_,
Theta_] := \[HBar]\[Omega]/
2*(3 (1 - p)^3 (Cos[Theta/2]^2 - Sin[Theta/2]^2) +
3 p^3 (Sin[Theta/2]^2 - Cos[Theta/2]^2) +
3*(p (1 - p)^2 (Cos[Theta/2]^2 - Sin[Theta/2]^2) +
p^2 (1 - p) (Sin[Theta/2]^2 - Cos[Theta/2]^2)));

EXFin[p_, Theta_] :=
3*\[HBar]\[Omega]/
2*(((1 - p)^3 + 3*p (1 - p)^2)*(Cos[Theta/2]^2 -
Sin[Theta/2]^2) + (p^3 + 3*p^2 (1 - p))*(Sin[Theta/2]^2 -
Cos[Theta/2]^2));

DeltaEX[p_, Theta_] := EXFin[p, Theta] - EXIni[p, Theta];

Show[Graphics3D[
MapThread[{Black, Arrow@Tube@{{0, 0, 0}, #1},
Text[#2, #1, {0, -2},
BaseStyle -> {FontSize -> 28}]} &, {2 IdentityMatrix[3], {x, y,
z}}], Boxed -> False, ImageSize -> Large, Lighting -> None],
SphericalPlot3D[1, {Theta, 0, \[Pi]}, {Phi, 0, 2*\[Pi]},
ColorFunction ->
Function[{x, y, z, Theta, Phi},
ColorData[{"TemperatureMap", {-0.216, 0.216}}][
DeltaEX[0.1, Theta]]], Boxed -> False,
PlotStyle -> Directive[Opacity[1]], ColorFunctionScaling -> False,
ImageSize -> Large, PlotPoints -> 120, MaxRecursion -> 10,
Mesh -> False,
PlotLegends ->
BarLegend[{"TemperatureMap", {-0.216, 0.216}},
LabelStyle -> {FontSize -> 30}]]]


It gives me the following plot :

As you an see, I have a weird lighting even if I put Lighting->None (for example the equatorial plane of the sphere is not fully white, it has some clear white-grey color variation).

How can I remove this effect ? I want a neutral plot.

• Your code does not reproduce the image shown for me (I get a uniformly gold colored sphere), but try Lighting -> {{"Ambient", White}} in SphericalPlot3D Commented May 17, 2019 at 14:38
• @MichaelE2 I forgot to add hbar omega=1 (see my edited post), it should work with it. Unfortunately your trick doesn't change much the graph. Commented May 17, 2019 at 15:27
• Put the Lighting -> {{"Ambient", White}} in the SphericalPlot3D instead of the Graphics3D, then it works. Note that only your arrows are in Graphics3D and your SphericalPlot3D is seperately included in Show Commented May 17, 2019 at 15:32
• @Ruud3.1415 indeed ! Thanks ! Could you explain me why to put it in Graphics3D doesn't work ? And what this command actually does in comparison of lightning none Commented May 17, 2019 at 15:33
• closely related: Option Lighting in the Show function does not work
– kglr
Commented May 18, 2019 at 4:15

1 Answer

Around V10, different objects in 3D graphics could be given individual lighting specs. The 3D plotting functions specify their own lighting, which they do by default if the user does not specify a lighting. This will override when using Show[] any settings that might be inherited from earlier graphics or explicitly set options. Usually the lighting is a colored lighting depending on the plot theme, but if ColorFunction is specified, the lighting seems to be set to "Neutral". So to override this behavior, you have to specify the lighting in the plotter, which I suggested in my comment.

So put Lighting -> {{"Ambient", White}} in SphericalPlot3D:

Show[Graphics3D[
MapThread[{Black, Arrow@Tube@{{0, 0, 0}, #1},
Text[#2, #1, {0, -2},
BaseStyle -> {FontSize -> 28}]} &, {2 IdentityMatrix[3], {x, y,
z}}], Boxed -> False, ImageSize -> Large, Lighting -> None],
SphericalPlot3D[1, {Theta, 0, \[Pi]}, {Phi, 0, 2*\[Pi]},
ColorFunction ->
Function[{x, y, z, Theta, Phi},
ColorData[{"TemperatureMap", {-0.216, 0.216}}][
DeltaEX[0.1, Theta]]], Boxed -> False,
PlotStyle -> Directive[Opacity[1]], ColorFunctionScaling -> False,
ImageSize -> Large, PlotPoints -> 120, MaxRecursion -> 10,
Mesh -> False,
PlotLegends ->
BarLegend[{"TemperatureMap", {-0.216, 0.216}},
LabelStyle -> {FontSize -> 30}],
Lighting -> {{"Ambient", White}}]
]