2
$\begingroup$

I'm trying to make a Black background 3D plot, but the Plot3D seems to introduce planes that cut the graphics, and cast shadows, and I can't figure out the option to make them go away. Here's an example:

ClearAll[e1, e2, e3]
{e1, e2, e3} = IdentityMatrix[3];

ClearAll[rcap, f]
rcap[theta_, phi_] :=
 e1 Sin[theta] Cos[phi] + e2 Sin[theta] Sin[phi] + e3 Cos[theta]

f[vp_] := Show[{
    ParametricPlot3D[ rcap[Pi/2, p], {p, 0, Pi/2},
     PlotRange -> 1.3 {{1, 1}, {-1, 1}, {-1, 1}},
     Boxed -> False,
     Ticks -> None,
     PlotStyle -> {White},
     PlotTheme -> "Marketing",
     Background -> Black,
     FaceGrids -> None
     ],
    ParametricPlot3D[ rcap[p, 0], {p, 0, Pi/2},
     PlotStyle -> {White}],
    ParametricPlot3D[ rcap[p, Pi/2], {p, 0, Pi/2},
     PlotStyle -> {White}],
    Graphics3D[{
      Opacity[0.7],
      Gray,
      Sphere[]
      }, Boxed -> False]
    },
   ViewPoint -> vp,
   ImageSize -> 0.6 {1920, 1080 }
   ];

f[{20, 11, 14}]

unwanted planes

Observe that when the Graphics3D object gets cut by these planes, so only part of the sphere is visible.

EDIT: In the comments, PloTheme -> "Marketing" was identified with the planes that were casting shadows, but if I remove that option there is still clipping without it:

still clipping

I think that even without "Marketing" there are still planes -- they just show up more clearly in the "Marketing" theme. If you look very closely, there are planes outlined by the thinnest white lines still visible in the output image.

Here's another view from viewpoint {-13, 40, 8} that makes the clipping more evident:

alternate viewpoint

Is there a way to remove that clipping? One option might be to offset all my graphics by a constant amount to avoid these (now barely visible) planes, but that will get confusing once I start adding additional elements into the mix.

$\endgroup$
7
  • $\begingroup$ the unwanted planes are injected by PlotTheme -> "Marketing" (see DisplayFunction /. Charting`ResolvePlotTheme["Marketing", ParametricPlot3D]). So you can add DisplayFunction -> Show before PlotTheme -> "Marketing" or remove PlotTheme -> "Marketing" $\endgroup$
    – kglr
    Sep 5 at 13:25
  • $\begingroup$ Thanks @kglr. It looks like there is still clipping without PlotTheme -> "Marketing", and it is not obvious what the source of that is. I've updated my question, incorporating your comment. $\endgroup$ Sep 5 at 13:45
  • $\begingroup$ e1, e2 and e3 are not defined. $\endgroup$
    – kglr
    Sep 5 at 13:50
  • $\begingroup$ Sorry, missed those making a stripped down reproducer. question edited to define those too. $\endgroup$ Sep 5 at 14:00
  • 1
    $\begingroup$ Yes, that was it. I'm surprised that doesn't result in an error message. Thanks! $\endgroup$ Sep 5 at 14:53

1 Answer 1

1
$\begingroup$

For reference, @kglr answered this in comments. There were two issues:

  1. PlotTheme -> "Marketing". This introduced the planes that produced the shadows.

  2. I had thought those planes were also clipping the result, but that turned out to be because of a typo in my PlotRange, where one of the coordinate ranges was {1,1} instead of {-1,1}

Without PlotTheme -> "Marketing", there are still a couple barely visible planes that ParametricPlot3D introduces (you can see them by their slightly white borders), however, they don't cast shadows, nor do any clipping.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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