2
$\begingroup$

I would like to generate a sphere with uniform surface brightness:

ParametricPlot3D[
 {Cos[θ] Sin[φ], Sin[θ] Sin[φ], Cos[φ]},
 {θ, 0, 2 π},
 {φ, 0, π},
 PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}, {-1.5, 1.5}},
 ColorFunction -> Function[{x, y, z}, GrayLevel[.5]],
 ColorFunctionScaling -> False,
 Lighting -> "Neutral"]

but this leads to a sphere is darker shading at the bottom:

shaded sphere

I've tried all manner of Lighting -> None, "None", etc., but still get either everything black or with the shading shown.

How do I get truly neutral ambient lighting, so the only variation in the appearance of the sphere is given by my ColorFunction?

Lighting-> {"Ambient"->White} simply does not work:

enter image description here

(version 11.3)

$\endgroup$
  • $\begingroup$ Lighting -> {"Ambient", White} $\endgroup$ – b3m2a1 Mar 28 at 2:18
  • $\begingroup$ ...and if your colors aren't parameter-dependent, just use PlotStyle; thus: Lighting -> {{"Ambient", White}}, PlotStyle -> GrayLevel[.5], PlotTheme -> None $\endgroup$ – J. M. will be back soon Mar 28 at 2:38
  • $\begingroup$ Why not use the point light source from a previous question, and place it at the center of the sphere? $\endgroup$ – mjw Mar 28 at 2:40
  • $\begingroup$ What version are you using? Lighting -> {"Ambient", White} works beautifully for me on macOS 11.3 $\endgroup$ – b3m2a1 Mar 28 at 2:40
  • 2
    $\begingroup$ The lighting you complain about is perfectly neutral; it just happens to be directional. That's why you need to add "Ambient"(same in every direction) to the lighting specification. $\endgroup$ – m_goldberg Mar 28 at 4:09
3
$\begingroup$

Just to show what {"Ambient", White} gives on macOS v11.3:

ParametricPlot3D[
 {Cos[θ] Sin[φ], Sin[θ] Sin[φ], 
  Cos[φ]}, {θ, 0, 2 π}, {φ, 0, π}, 
 PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}, {-1.5, 1.5}}, 
 ColorFunction -> Function[{x, y, z}, GrayLevel[.5]], 
 ColorFunctionScaling -> False, Lighting -> {"Ambient", White}
 ]

enter image description here

And here's the same from the Cloud:

enter image description here

$\endgroup$
3
$\begingroup$
 ParametricPlot3D[
 {Cos[θ] Sin[φ], Sin[θ] Sin[φ], Cos[φ]},
 {θ, 0, 2 π},
 {φ, 0, π},
 PlotRange -> {{-1.5, 1.5}, {-1.5, 1.5}, {-1.5, 1.5}},
 ColorFunction -> Function[{x, y, z}, GrayLevel[.75]],
 ColorFunctionScaling -> False,
    Lighting -> {"Point", White, {0, 0, 0}}]

enter image description here

Lighting with a point source was discussed here, in a previous question.

$\endgroup$
0
$\begingroup$

Do not change the lighting. Change the surface properties instead. The key is Glow.

PlotStyle -> Directive[Black, Glow[Red]]

enter image description here

We set the colour to black so no light is reflected (and the lighting has no effect on the rendered colour). Now whatever colour you put in Glow[...] will be used for rendering the entire object.

This is not only a simpler solution, it also allows mixing shaded and flat objects in the same scene.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.