# Graphics resolution issue

I have an issue with how different types of graphics are rendered alone versus in combination. If I render a simple circle like so:

Show[Graphics[{Thickness[0.01], Circle[{0, 0}, 0.8]}]]


I get a nicely rendered circle:

However, if I combine this with a slightly more fancy object like so:

Show[Graphics[{Thickness[0.01], Circle[{0, 0}, 0.8]}],
ParametricPlot[{Cos[t], Sin[t]}, {t, 0, 2 Pi},
PlotStyle -> Directive[Thickness[0.01]], Axes -> False,
Frame -> False, ColorFunctionScaling -> False,
ColorFunction -> (Hue[0.1184738955823293,
0.9378531073446328, ((1. - Sin[#3 + Pi])/2.)^0.7] &)]]


I get this:

in other words, some fairly crudely rendered, pixelated objects. How can I fix this?

P.S.: I have found a reference to a similar issue here which is somewhat disheartening. If this issue still exists (the post I just referenced is almost ten years old) then we may be out of luck: Use of Colorfunction may ruin rendering quality of all graphics nearby.

P.P.S.: Oh, and to clarify, this is a Mathematica on Windows issue. Mathematica seems to (have to?) handle certain types of 2D graphics in a kludgy way, passing them to a 3D graphics subsystem that does not offer the kind of anti-aliasing that's done for 2D graphics. I don't know if this is a Windows issue or just an issue with the graphics framework that Wolfram chose to use. The issue does not exist on Linux or MacOS.

• I see no issue on MMA 11.3 Linux. Have you tried adding Antialiasing -> True in the second case? – anderstood Jun 1 '18 at 16:20
• I just tried your Antialiasing idea, and it made no difference. This is Mathematica 11.2 on Windows 10, on an external high-resolution display. Of course, that means that Mathematica has horrible font rendering issues already, but standard graphics are rendered fine. The issue seems to be with that ParametricPlot which is not rendered nicely even by itself, and when it's combined with other graphics everything gets rendered at the low resolution. But, I wouldn't be surprised if all of this ultimately came down to a Mathematica on Windows issue. There's plenty of those... – Pirx Jun 1 '18 at 16:32
• The outputs you posted are larger than they should be: how are you enlarging the images? You might also make some experiments with Rasterize to help finding out what the issue is. – anderstood Jun 1 '18 at 16:35
• I found this is related to ColorFunction. ColorFunction -> Automatic gives smooth plot. – Gopal Verma Jun 1 '18 at 16:51
• Hah, interesting. Now the question that remains is, how can I get my fancy coloring (have my cake) and still get a smooth plot (and eat it), too? – Pirx Jun 1 '18 at 16:53

It's difficult to tell from your screenshots (which might have been scaled onto the website)...are you saying that there's no antialiasing, or different antialiasing? It is certainly true that the antialiasing, or lack thereof, in your graphic with the ParametricPlot is governed by the 3D drawing system. Many 2D drawing subsystems have various sorts of limitations which can be resolved by going to OpenGL/Direct3D. The most common limitations are the proper drawing of gradients (which is the issue here), or transparency. If a construct that requires specialized rendering exists, then the graphic must be drawn, in its entirety, in the 3D subsystem.

Additionally, the Antialiasing option applies only specifically to the 2D drawing system (and not even to the portion of it that draws fonts). So, the setting of the Antialiasing option won't make a difference in any 2D graphic which is forced to be rendered in the 3D subsystem.

However, the 3D subsystem does, in fact, support antialiasing. It works a bit differently from the 2D version. One big limitation is that antialiasing is either on or off for the entire system; it can't be controlled for individual graphics or even primitives as it can be in the 2D drawing subsystems. This is a limitation of the technology we use, not a limitation we really wanted to impose.

Controlling the antialiasing can be done in the Preferences dialog, in the Appearance->Graphics subpanel. It's a slider which indicates "how much" antialiasing you want, where the details of what, exactly, this means may vary depending upon your graphics hardware.

This is really just a nice interface for the RenderingOptions->{"HardwareAntialiasingQuality"} option, which is documented here, although the documentation does not clearly state that this option can only be effectively set at the global level.

Indeed, if I take your example, and I compare it with the option set to 0 and to 1, I see differences. You should, too, although depending upon your hardware, it may very well not be pixel-perfect to the rendering on my hardware. These are screenshots which I scaled up pieces of, rendered on my Windows machine with an NVIDIA GeForce GTX 960 and version 11.3.

If you're seeing no antialiasing at all, the most likely problem is that you have this slider set to turn antialiasing off. If your concern is that the antialiasing is different, you should still check to ensure that the slider is all the way to the right, but there may not be much that can be done at this time.

Older versions of Mathematica had the slider set to be off by default. I can't remember exactly when the switchover happened, but I'm fairly certain anything v11 and later will, by default, have 3D antialiasing on. But if you've ever manipulated this slider by hand, it will remember your setting rather than using the default setting.

• Thanks John. I did have the antialiasing slider all the way to the right, but to be honest, while there is a difference between different settings of the slider, even at its maximum setting the rendering of lines looks pretty horrendous. I suppose you would say the antialiasing is just different, but it is very different. Specifically, the rendering of those circles with and without gradients is like night and day. And, I do not see these differences on my MacBook. My PC is a workstation-class laptop with an Nvidia Quadro P4000 card which should certainly be up to the challenge. – Pirx Jun 2 '18 at 3:29
• As an aside, since you mention font rendering, that, of course, is a complete disaster on high-DPI PC displays. Completely and utterly unacceptable. I wonder if there is any hope to see this fixed during this decade... – Pirx Jun 2 '18 at 3:32
• If your display is a high resolution display, then that almost certainly is playing a role in your problem as well. We're simply not supporting such displays properly under Windows yet, and so we're running in a scaling mode provided by Windows for backward compatibility for non-supporting apps (and I would guess that the scaling mode is affecting Direct3D differently than the 2D GDI drawing system). It is being worked on, but I'm not ready yet to suggest a release date for that work. We're well aware that lots of people are really interested in seeing this fixed. – John Fultz Jun 3 '18 at 13:11
• Hmm, I take that to mean "Not in 11.3". That's too bad. I wonder, while you're fixing those problems, will there be any chance that the decades-old issue with incorrect font sizes in Windows will be fixed also? Either way, thanks very much for your straight answer! – Pirx Jun 4 '18 at 0:09
• @Pirx I'm not sure if we're ever going to fix the font size thing in Windows on 100% scaled screens. There's so much legacy there, and it's not just font sizes, but the sizes of everything (either the fonts change by themselves, in which case they look wrong relative to everything else, or everything changes, with dramatic consequences and even things like WindowSize don't mean the same thing anymore). But we are going to fix the mis-scalling at other screen scales, where we'll have more freedom to break from history and start with a blank slate. But I'm not promising a ship date, yet. – John Fultz Jun 26 '18 at 18:02