4
$\begingroup$

I am running MacOS 10.11.5 and I have recently upgraded from Mathematica version 8.0.1 to version 11.3.0. I created the animation for this answer on Mathematics using the Mathematica code

f[x_] := 
  ParametricPlot3D[
    {(t (1 - t))^(3/2) Cos[2 Pi s], t, (t (1 - t))^(3/2) Sin[2 Pi s]}, 
    {t, 0, 1}, {s, 0, 1}, 
    Axes -> False, Boxed -> False, 
    Mesh -> 
      {15, {1/1200, 1/12, 2/12, 3/12, 4/12, 5/12, 6/12, 7/12, 8/12, 9/12, 10/12, 11/12}}, 
    ViewVector -> {{10 Cos[x], 10 Sin[x] + 1/2, 0}, {0, 1/2, 0}}, 
    ViewVertical -> {0, 0, 1}, 
    ViewAngle -> 1/36, 
    ImageSize -> {400, 100}, 
    PlotTheme -> {"Classic"}, 
    MeshStyle -> Directive[Thickness[1/144]]]

The PlotTheme -> {"Classic"} is ignored in 8.0.1, but is needed in 11.3.0 to get the same lighting and color scheme.

Under 8.0.1, I exported the GIF animation with

Export["potatoes8.gif", Table[f[Pi k/32], {k, 0, 31}], "GraphicsList",
  "DisplayDurations" -> .05]

enter image description here

and under 11.3.0, I exported the GIF animation with

Export["potatoes11.gif", Table[f[Pi k/32], {k, 0, 31}], "GraphicsList", 
  "DisplayDurations" -> .05, AnimationRepetitions -> Infinity]

enter image description here

The output from 11.3.0 is much worse than that from 8.0.1. The MeshStyle option in the code above was added to try to make the mesh thicknesses similar, as was the PlotStyle option for the lighting.

I have tried different Thicknesses for the MeshStyle, but those that give unbroken mesh lines, give lines that are way too thick.


An interesting thing is that under 8.0.1, in the Notebook, the rendered image and the rasterized image look identical:

enter image description here

However, under 11.3.0, in the Notebook, the rendered image is at a higher resolution than under 8.0.1 (this is a good thing), but the rasterized image looks worse than under 8.0.1 (and at the same resolution):

enter image description here

It would be great to get the higher resolution images from 11.3.0 in the animation, but I would be happy if the animation under 11.3.0 were at least as good as that under 8.0.1.

Does anyone have any suggestions of what might be done to improve the rasterization quality under 11.3.0?


Update

Using the antialias function supplied by halirutan,

antialias[g_, n_:3] := ImageResize[Rasterize[g, "Image", ImageResolution -> n 72], Scaled[1/n]]

I was able to get much better results and also reduce the mesh thickness with MeshStyle -> Directive[Thickness[1/300]]. However, this exposed a limitation in the surface rendering (the subdivisions of the surface were quite visible) that I was able to remedy by setting PlotPoints->120.

Here is the result of

Export["potatoes11.gif", Table[antialias[f[Pi k/32], 10], {k, 0, 31}], "GraphicsList", "DisplayDurations" -> .05, AnimationRepetitions -> Infinity]

enter image description here

Note that with a scale of 8 or less in the antialias function, the images were still bad, but with 9 or more, they suddenly became much better.

Why this extra machination needs to be added to the basic Export, which used to work just fine, might still be considered a bug in Mathematica 11.3.

$\endgroup$
4
$\begingroup$

What happens if you go to Edit | Preferences | Appearance | Graphics and crank the slider for "Antialiasing Quality" up to highest quality?

Also, you might want to consider trying the antialias functions given here and here. Those posts might contain additional helpful information about the topic.

When you do this, it's easy to get something like this

enter image description here

|improve this answer|||||
$\endgroup$
  • $\begingroup$ The slider was already at the highest and I was getting what I posted. I used your antiaiias function with a scale of 10 and got much better results. Thanks. $\endgroup$ – robjohn Nov 19 '19 at 3:45
1
$\begingroup$

I'm running V11.5.0 on MacOS 1013.4 and I get the same results as you with the default setting for Rasterize, but if change them with options, I can get a high quality rasterization

f[0]

vector_image

Rasterize[f[0],
  RasterSize -> 800, ImageSize -> Automatic, ImageResolution -> 800]

raster_image

|improve this answer|||||
$\endgroup$
  • $\begingroup$ (+1) I tried those values, but the image came out even worse on my machine. However, when I used the antialias function from halirutan's answer, with a magnification/reduction factor of 10, it worked. $\endgroup$ – robjohn Nov 19 '19 at 3:43

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.