# How to achieve a decent terminator line?

What I did:

ParametricPlot3D[{z,Cos[z/2]^0.5 Cos[t]/0.6,Cos[z/2]^0.5 Sin[t]*0.6},
{t,-Pi, Pi},{z,-Pi,Pi}, Mesh->None,PlotPoints->50,
PlotRange -> All,Exclusions->None, AxesLabel->{x,y,z},
Lighting -> {{"Directional",RGBColor[1, 1, 1], {-2,1,0}}}]


What I got:

What I want: a decently rendered terminator!

• You have two separate PlotPoints specified and only the first (with the lower value) is used. – Bob Hanlon Jul 29 '15 at 0:17
• Like this? -- Is there another meaning to Terminator? – Michael E2 Jul 29 '15 at 1:00
• @Michael E2 What I want is diffuse region like this i.imgur.com/39JTsAK.png though in this case narrower, due to the brighter lighting. – ChrisJJ Jul 29 '15 at 17:23
• This was a good terminator line. – Daniel Lichtblau Jul 29 '15 at 19:25
• Related: (88319) – Mr.Wizard Jul 31 '15 at 5:20

## 2 Answers

Use larger value for PlotPoints. What is acceptable is subjective. You will need to experiment to find the smallest value with results that are acceptable to you for whatever your purpose is.

ParametricPlot3D[{z, Cos[z/2]^0.5 Cos[t]/0.6,
Cos[z/2]^0.5 Sin[t]*0.6}, {t, -Pi, Pi}, {z, -Pi, Pi}, Mesh -> None,
PlotPoints -> 250, PlotRange -> All, Exclusions -> None,
AxesLabel -> {x, y, z},
Lighting -> {{"Directional", RGBColor[1, 1, 1], {-2, 1, 0}}}]


• I was hoping for a solution which was less costly than simply reducing the size of the badly-shaded patches, and which didn't lose the gradation, but if that's as good as it gets, so be it :-) Thanks. – ChrisJJ Jul 29 '15 at 18:02

Sharp border:

f = {z, Cos[z/2]^(1/2) Cos[t]/0.6, Cos[z/2]^(1/2) Sin[t]*0.6};
ParametricPlot3D[f, {t, -Pi, Pi}, {z, -Pi, Pi},
MeshFunctions -> {Function[{x, y, u, t, z},
Evaluate@Dot[Cross @@ Transpose@D[f, {{t, z}}], {-2, 1, 0}]]},
Mesh -> {{0}}, PlotStyle -> Specularity[0],
MeshShading -> {Black, LightGray}, PlotPoints -> 50,
PlotRange -> All, AxesLabel -> {x, y, z}, Lighting -> "Neutral"]


Extremely diffuse border, due to the shape of the object, direction of light & lighting model:

f = {z, Cos[z/2]^(1/2) Cos[t]/0.6, Cos[z/2]^(1/2) Sin[t]*0.6};
ParametricPlot3D[f, {t, -Pi, Pi}, {z, -Pi, Pi}, MeshFunctions -> {},
PlotStyle -> White, PlotRange -> All, AxesLabel -> {x, y, z},
Lighting -> {{"Directional", White, {-2, 1, 0}}}]


Update: For what it's worth, here is a model similar to the second plot above, except that is has the default Specularity of ParametricPlot3D. It is much faster, due to the use of Sphere and "SpherePoints", and has fine resolution of the terminator.

Graphics3D[{
Directive[Specularity[GrayLevel[1], 3], RGBColor[0.880722, 0.611041, 0.142051]],
GeometricTransformation[Sphere[],
ScalingTransform[
MaxValue[{#, -Pi <= t <= Pi && -Pi <= z <= Pi}, {t, z}] & /@ Rationalize@f
]]},
PlotRange -> All, Axes -> True, AxesLabel -> {x, y, z},
Lighting -> {{"Directional", White, {-2, 1, 0}}},
Method -> {"SpherePoints" -> 500}]


• I was looking to retain diffusion. Thanks for option #2, but its apparent improvement is just the result of you dropping the specularity and thereby spreading the diffusion. With specularity restored, the result is actually worse: i.imgur.com/DssUOmP.png . – ChrisJJ Jul 29 '15 at 18:13
• @Chris Oh well, I didn't appreciate the effect of specularity, nor was it clear that it was required. If it's exactly this shape or something very close to it, then it might be possible to do to improve it. The 250-PlotPoint graphics are still pretty ragged. But I don't want to waste my time, if it's not going to be any help. – Michael E2 Jul 29 '15 at 18:27
• Out of interest, what's the advantage of your move of ParametricPlot3D's parameter #1 into f? – ChrisJJ Jul 29 '15 at 18:27
• "in the gradient computed in MeshFunction" Ah, I missed that. Thanks. – ChrisJJ Jul 29 '15 at 19:58
• "It is much faster" Agreed. I used ParametricPlot3D because in general I need a paramteric plot. "has the default Specularity of ParametricPlot3D" How did you discover that default? Can code inspect the value? The docs tell me only "Automatic". – ChrisJJ Jul 29 '15 at 20:01