How do I remove artifacts from my ContourPlot3D Valentine?
RegionPlot3D
can sometimes give cleaner results out of the box. I also upped the PlotPoints
manually.
Manipulate[
RegionPlot3D[(x^2 + ((1 + b)*y)^2 + z^2 - 1)^3 - x^2*z^3 -
a*y^2*z^3 <= 0, {x, -scale, scale}, {y, -scale,
scale}, {z, -scale, scale}, Mesh -> None, Axes -> None,
Boxed -> False,
PlotStyle -> Directive[Red, Opacity[0.8], Specularity[White, 30]],
PlotPoints -> ControlActive[Automatic, 40]], {{a, .1}, .0001,
1}, {{b, 1}, .00001, 5}, {{scale, 1.25}, 1, 5},
SynchronousUpdating -> False]
Adding the ContourPlot3D
option PlotPoints -> n
where n
is some number greater than or equal to 100 improved things considerably for me. There is still a very faint ring around the lower portion of the heart when I do this, but it's a considerable improvement.
The PlotPoints
argument tells Mathematica how many points to use when initially sampling the plot. Many functions (including 2D functions like DensityPlot
) accept this argument. For whatever reason, the default is often quite low for functions/plots with rapid changes or singularities.
Demo:
First, without any additional argument:
Then with PlotPoints -> 200
.