Explainer: Pixel density and display resolution

One of the small quirks of running lightweight virtual machines on Apple silicon Macs is that their virtual displays can look slightly blurred. When investigating this, I entered the profoundly confusing world of pixel density and display resolution, and thought some clarification might help.

What we normally refer to as display resolution might better be termed display dimensions, and gives the width and height of the display image in screen pixels, such as 5120 x 2880. If you know those dimensions in regular units of length like inches or centimetres, you can calculate the density of screen pixels per inch or centimetre, the pixel density. In the case of this iMac Pro Retina display, that works out at around 218 pixels per inch, or 86 pixels per centimetre.

Going back to the days of classic Macs, Apple standardised on a pixel density of 72 pixels per inch, and on those primitive displays scaling pixelmaps to multiples of that resulted in the crispest of display images. It’s an attractive idea that you can generate a crisper image on a modern display using the same principle, so the first task is to discover what pixel densities Apple uses for its various Retina displays.

That isn’t as easy as you might think. Open the About This Mac window, click on Displays, and you’ll be told the display dimensions of each display currently connected to that Mac, but there’s no sign of any figures for their pixel densities. Fortunately, Apple publishes an incomplete compilation of native values in this article. It came as a shock to discover that each of Apple’s Retina displays seems to have its own pixel density, with no less than 6 different values ranging from 218 to 254. Some kind soul at Wikipedia has extended that list to cover 8 different pixel densities for Macs alone, without going near those listed for iPads and iPhones.

While I’m carefully avoiding going into other devices, allow me to explain the underlying rationale behind all those pixel densities. Their aim is to produce a display whose individual pixels aren’t seen by the user. That depends on both pixel density and the distance between the eye and the display. The key parameter is measured by calculating the angular pixel density (in pixels/˚ or PPD) using
2dr tan(0.5˚)
where d is the distance between the eye and screen, and r is the pixel density. For Mac displays where the eye is going to be at least 20 inches (50 cm) from the display, Apple’s Retina displays deliver angular pixel densities of 76-92 pixels/˚, deemed sufficient for humans to perceive smooth forms rather than pixels. Smaller displays on smaller devices are also held closer to the eye, but still need to deliver similar angular pixel densities to work as well.

Macs have changed in other ways since those heady days of 72 pixels per inch. Most important here is the move from pixel-based to vector graphics. Text isn’t rendered now using bitmap fonts, but using faired curves, then antialiased. As anyone with an old pre-Retina display knows, antialiasing has changed recently.

macOS Mojave removed subpixel antialiasing or rendering, long used to improve the appearance and readability of screen fonts. The only form of antialiasing available in Mojave and later is linear blend, enabled with Font smoothing in the General pane. That works just fine with a Retina display, where it shouldn’t even be necessary, but as those with older displays have discovered, it isn’t as good as subpixel antialiasing on non-Retina displays.

So, whatever the display dimensions, your Mac’s Retina display should show pin-sharp, smoothly rendered text and graphics. Which leaves us the mystery of why this isn’t as good in a lightweight virtual machine.

The secret here seems to lie in what’s sometimes known as HiDPI, switching effective display resolution to twice its normal without changing dimensions. This has been available for Retina displays through the Displays pane: switch the resolution to Scaled while holding the Option key, tick the box to Show all resolutions, and you should be offered additional HiDPI settings. Getting those to work in a virtual machine is another story, but it’s worth the effort, and will come shortly in the next version of Viable.

For those working normally with Retina displays, though, all this is but an interesting distraction. Just set your desired display dimensions in the Displays pane, and it should all work crisp and even.