7
$\begingroup$

The finest 3D surface plots I've seen so far were created with MuPAD, which has been discontinued for many years unfortunately. Here's an example: 3D plot from MuPad

How can I achieve similar results with Mathematica? I care about the quality of the surface shading. The contour plot on the bottom isn't relevant here.

$\endgroup$
5
  • 3
    $\begingroup$ You could try POVRay. $\endgroup$
    – anderstood
    Feb 17, 2018 at 14:55
  • $\begingroup$ Can you please provide the equation of this surface in MA format. $\endgroup$
    – yarchik
    Feb 17, 2018 at 16:28
  • 4
    $\begingroup$ That's true, MuPAD's graphics defaults were quite nice. (The rest was quite inefficient and unwieldy, though.) In Mathematica, you can add specular effects by injecting Specularity directives though the PlotStyle option into Plot3D. The plot shown above contains also several (white) light sources. These can be set through the option Lighting. $\endgroup$ Feb 17, 2018 at 17:44
  • 4
    $\begingroup$ mupad was not discontinued. It was bought by Mathworks. (after Mathworks stopped using Maple as its math symbolic engine). I still use it from time to time from inside Matlab. as was mentioned above, it might have good graphics, but it is not too strong in other areas as integration and differential equations. see for example how it did against Mathematica and others in integration tests here $\endgroup$
    – Nasser
    Feb 17, 2018 at 20:24
  • $\begingroup$ Just for reference, Asymptote gives very nice results too. See e.g. this or this. $\endgroup$
    – anderstood
    Feb 19, 2018 at 1:05

1 Answer 1

14
$\begingroup$

Not exactly, but maybe a good start

xmx = 1;
CoolColor[ z_ ] := RGBColor[z, 1 - z, 1];
f = x^3 - 3 x y^2;
surf = Plot3D[f, {x, -xmx, xmx}, {y, -xmx, xmx}, AspectRatio -> 0.8, 
   PlotRange -> {-xmx, xmx} , PlotPoints -> 50, ClippingStyle -> None,
    Mesh -> 20, PlotStyle -> Directive[Specularity[White, 100]], 
   ColorFunction -> CoolColor, Lighting -> {None, "Directional"}];
slice = SliceContourPlot3D[f - xmx, 
   z == -xmx, {x, -xmx, xmx}, {y, -xmx, xmx}, {z, -xmx, xmx}, 
   Contours -> 16, ContourShading -> None, ContourStyle -> Red];
Show[surf, slice, Axes -> {False, False, False}, ImageSize -> 800]

enter image description here

Playing with other parameters and adding the antialiasing I got the following

surf = Plot3D[f, {x, -xmx, xmx}, {y, -xmx, xmx}, AspectRatio -> 0.9, 
    PlotRange -> {-xmx, xmx}, PlotPoints -> 50, 
    ClippingStyle -> None, Mesh -> 20, 
    ColorFunction -> (Directive[Specularity[0.5, 20], Glow@CoolColor[#]] &), 
    Lighting -> {{"Spot", White, Scaled[{r Cos[p] Sin[t], r Sin[p] Sin[t], r Cos[t]}], a}}, 
PerformanceGoal -> "Quality"] /. {r -> 0.7, p -> 4, t -> 0.4, a -> 0.75};
slice = SliceContourPlot3D[f - xmx, 
   z == -xmx, {x, -xmx, xmx}, {y, -xmx, xmx}, {z, -xmx, xmx}, 
   Contours -> 16, ContourShading -> None, ContourStyle -> Red];
gr = Show[surf, slice, Axes -> {False, False, False}, 
  ImageSize -> 300]

enter image description here

$\endgroup$
3
  • $\begingroup$ Thank you, it's a start! Somehow the MuPAD one looks even more glossy. I don't know what it is, sharper specularity, more diffuse shading, several light sources?? $\endgroup$
    – user55344
    Feb 18, 2018 at 15:22
  • $\begingroup$ @user55344 I think they have indeed 3 light sources. I've used only one. $\endgroup$
    – yarchik
    Feb 18, 2018 at 15:32
  • $\begingroup$ @user55344 In v12.3 Lighting ->"ThreePoint" is introduced. $\endgroup$
    – xzczd
    May 21, 2021 at 7:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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