# Removing plot artifacts (SphericalPlot3D)

Using SphericalPlot3D, I find I get two types of artifact:

1. A discontinuity in the surface reflectance at $\theta=0,2\pi$
2. Little edges, or perhaps gaps between faces, showing in some regions — this depends very much on the angle that the object is viewed from. If you run the code below, it might not show it without some rotation.

They can both be seen in this How do I get rid of them?

Here's the code to reproduce the problem.

GreatCircleDistance[a_, b_] := ArcCos[(a.b)/(Norm[a, 2] Norm[b, 2])]

SphereToCart[{r_, ϕ_, θ_}] = r {Cos[θ] Sin[ϕ], Sin[θ] Sin[ϕ], Cos[ϕ]}

TotalDistance[θ_, ϕ_] :=
3 +
Plus @@
(Exp[-10 GreatCircleDistance[SphereToCart[{1, θ, ϕ}], #]^2] & /@
(PolyhedronData["Icosahedron", "VertexCoordinates"] // N))

SphericalPlot3D[TotalDistance[θ, ϕ], {θ, 0, π}, {ϕ, 0, 2 π},
PlotStyle -> Directive[Orange, Opacity, Specularity[White, 10]],
Mesh -> None,
PlotPoints -> 30]

• What version are you using? Jul 24, 2016 at 3:48
• Looks like a discontinuity in the computed normals. Using ParametricPlot3D[] instead works: With[{icos = N[PolyhedronData["Icosahedron", "VertexCoordinates"]]}, ParametricPlot3D[With[{sph = {Cos[ϕ] Sin[θ], Sin[θ] Sin[ϕ], Cos[θ]}}, (3 + Sum[Exp[-10 VectorAngle[sph, pts]^2], {pts, icos}]) sph], {θ, 0, π}, {ϕ, 0, 2 π}, Mesh -> None, PlotPoints -> 30, PlotStyle -> Directive[Orange, Specularity[1, 10]]]]. Jul 24, 2016 at 4:28
• @Young Version 10.3 Jul 25, 2016 at 2:55
• @J.M. I agree it is a problem with normals, I think it might count as an bone fide bug too (the normal calculation is probably missing a factor of two somewhere). Jul 25, 2016 at 3:00

Compute the normal manually (SphericalPlot does it from the polygons:

SphericalPlot3D[
TotalDistance[θ, ϕ] /. Abs[x_]^2 -> x^2, {θ,
0, π}, {ϕ, 0, 2 π},
PlotStyle -> Directive[Orange, Opacity, Specularity[White, 10]],
Mesh -> None, PlotPoints -> 30,
NormalsFunction -> Function[{x, y, z, θ, ϕ, ρ},
Evaluate@
With[{r =
TotalDistance[θ, ϕ] /. Abs[a_]^2 :> a^2 //
Simplify},
Cross @@
Transpose@
D[
r {Sin[θ] Cos[ϕ], Sin[θ] Sin[ϕ],
Cos[θ]}, {{θ, ϕ}}]
]
]
] 