# How to get rid of clipping artifacts?

The following is a MWE extracted from a more complex graphic.

vertex = {8 Sqrt[2/((5 - Sqrt) (10 + 2 Sqrt))], 0, 8/
Sqrt[(10 - 2 Sqrt) (10 + 2 Sqrt)]};
example[r_] :=
Show[Graphics3D[{Opacity[0.3, GrayLevel[0.8]], Sphere[{0, 0, 0}, r],
GrayLevel[0.2], Opacity,
Style[Sphere[{0, 0, 0}, 3],
ClipPlanes ->
Hyperplane[vertex, Cos[30 Degree]*3*Normalize[vertex]]]},
Boxed -> False], Lighting -> "Neutral",
ViewPoint -> {1.7, -2.7, 1}, ViewVertical -> {0, 0, 1},
ImageSize -> {1000, Automatic}]

Export["ex1.png", example]
Export["ex2.png", example[3.001]]  The second example is a bit better than the first one, but both show artifacts that I'd like to get rid of. (To clarify what I'm talking about: In both cases, the boundary of the spherical cap is clearly some $$n$$-gon and not a circle. And Example[2.999] would have the same effect.)

How can I improve this? Is there a way to increase the mesh granularity of the sphere? Or is there a better way to create the spherical cap?

You can add Method -> {"SpherePoints" -> 300}. With this option there are no artifacts:

example[r_] :=
Show[Graphics3D[{Opacity[0.3, GrayLevel[0.8]], Sphere[{0, 0, 0}, r], GrayLevel[0.2],
Opacity,
Style[Sphere[{0, 0, 0}, 3],
ClipPlanes -> Hyperplane[vertex, Cos[30 Degree]*3*Normalize[vertex]]]},
Boxed -> False, Method -> {"SpherePoints" -> 300}], Lighting -> "Neutral",
ViewPoint -> {1.7, -2.7, 1}, ViewVertical -> {0, 0, 1}, ImageSize -> {1000, Automatic}]


Checked with version 12.0 on Windows 7 x64.

• Thanks, that's what I was looking for. I'd say this is almost impossible to find in the Mathematica documentation unless you already know the answer... – Frunobulax Oct 28 '19 at 9:48