6
$\begingroup$

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:

enter image description here

What I want: a decently rendered terminator!

$\endgroup$
  • $\begingroup$ You have two separate PlotPoints specified and only the first (with the lower value) is used. $\endgroup$ – Bob Hanlon Jul 29 '15 at 0:17
  • 1
    $\begingroup$ Like this? -- Is there another meaning to Terminator? $\endgroup$ – Michael E2 Jul 29 '15 at 1:00
  • 1
    $\begingroup$ @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. $\endgroup$ – ChrisJJ Jul 29 '15 at 17:23
  • 3
    $\begingroup$ This was a good terminator line. $\endgroup$ – Daniel Lichtblau Jul 29 '15 at 19:25
  • 1
    $\begingroup$ Related: (88319) $\endgroup$ – Mr.Wizard Jul 31 '15 at 5:20
4
$\begingroup$

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}}}]

enter image description here

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – ChrisJJ Jul 29 '15 at 18:02
12
$\begingroup$

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"]

Mathematica graphics

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}}}]

Mathematica graphics

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}]

Mathematica graphics

$\endgroup$
  • 1
    $\begingroup$ 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 . $\endgroup$ – ChrisJJ Jul 29 '15 at 18:13
  • $\begingroup$ @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. $\endgroup$ – Michael E2 Jul 29 '15 at 18:27
  • $\begingroup$ Out of interest, what's the advantage of your move of ParametricPlot3D's parameter #1 into f? $\endgroup$ – ChrisJJ Jul 29 '15 at 18:27
  • $\begingroup$ "in the gradient computed in MeshFunction" Ah, I missed that. Thanks. $\endgroup$ – ChrisJJ Jul 29 '15 at 19:58
  • $\begingroup$ "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". $\endgroup$ – ChrisJJ Jul 29 '15 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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