Skip to content ↓


Nonblurry integer-ratio scaling

Summary
Scaling built into monitors and graphics drivers leads to blur. The issue could be solved by implementing integer-ratio scaling via graphics drivers, but for now, there are partial solutions and indirect ways to encourage developers of graphics drivers to implement lossless scaling.

In a nutshell (tl;dr)

Issue

Monitors and graphics cards at video signal’s resolution lower than display’s physical resolution add blur to the image even when this could be avoided. As a result, Full HD on 4K monitor looks worse than on Full HD monitor.

Solution

When scaling, each logical pixel could be displayed as a square group of integer (2×2, 3×3) number of physical pixels of the same color with the resulting image centered on the screen. See the live demo.

Get involved

  • Sign the petition about implementing nonblurry scaling in graphics drivers.
  • Spread the word about the blur issue to your friends and specify links to the petition and the article.
  • Express your support in forums: GeForce, AMD, Intel, Reddit.
  • Complain of blur to technical support: nVidia, AMD (1, 2) or Intel (1, 2).
  • Request adding the feature to popular game engines: Unreal Engine, Unity, CryEngine.

What scaling is

Scaling is resizing (changing resolution of) an image. It is needed if physical resolution (number of pixels in horizontal and vertical directions) of a monitor or a TV set is different from the resolution of the video signal it receives: e. g. if a game in the resolution of 1920×1080 (Full HD) is running in full-screen mode on a monitor with physical resolution of 3840×2160 (4K).

The blur issue

With all monitors, graphics cards and most TV sets, scaling always leads to losing sharpness at any scaling ratio. Such sharpness loss is perceived as blur and is irreversible quality loss.

But actually, blur is only inevitable if the monitor’s resolution is not a multiple of the signal’s resolution. For example, it’s impossible to display one logical pixel as 1.5 physical pixels, so we are forced to use interpolation that calculates average colors of adjacent pixels of the image which is subject to scale.

Solution — integer-ratio scaling

If the scaling ratio is not fractional (e. g. 1.5), but integer (e. g. 2 or 3), the blur can be avoided just by displaying each logical pixel as a square group of an integer (e. g. 2×2 or 3×3) number of physical pixels of the same color — i. e. just by duplicating the corresponding pixel of the original image multiple times with no any diffusion of colors of sibling pixels.

More than nearest neighbour

Blur can be avoided even if resolutions are not divisible: it’s enough to scale with an integer ratio so that the image fills the screen as fully as possible, and to fill the rest screen space with black background the same way as when the image is centered on the screen with no scaling.

For example, we can display a 1280×1024 image on a 3840×2160 screen by displaying each image pixel as a group of 4 (2×2) identical physical pixels with black margins of 56 physical pixels above and below, and 640 pixels — leftward and rightward.

This is the key difference of integer-ratio scaling from scaling via nearest-neighbour interpolation. Their results are only identical at integer ratios of physical and logical resolutions. At fractional ratios, nearest-neighbour interpolation results in image distortion, while with integer-ratio scaling, the image is always scaled with an integer ratio and with no quality loss — even if physical and logical resolutions are not divisible.

Examples

Pixel art

The differences between lossless integer-ratio scaling and bicubic interpolation with blur are clearly evident on a pixel-art image:

Photos

See also the photos of the same screenshot of the Reaper application taken using the three scaling methods:

Demo

For better understanding of what nonblurry integer-ratio scaling is, see the web demo.

Why it’s important

  • With 4K monitors of 24—27″ size at Full HD resolution, single image pixels are almost indistiguishable, so blur does not add any smoothing and just senselessly decreases sharpness resulting in an unreasonable quality loss.
  • All 4K monitors use scaling with blur, so the issue can be solved only via graphics driver.
  • In the nVidia G-Sync mode, monitor’s own scaling feature is not used (1, 2), so the only way to scale properly is scaling via graphics driver.
  • Graphics drivers of nVidia and AMD already have implemented technologies of resolution virtualization — nVidia DSR and AMD VSR, so the only missing technical thing is support for ratios below 1.
  • Purchasing a higher-performance graphics card is not a solution:

    • many games contain bitmap elements (e. g. menu in “Half-Life 2” and control panels in “Cities XL Platinum”) which get small at 4K resolution;
    • some games (e. g. “Duck Tales Remastered”) have real resolution of Full HD while support for other resolutions is achieved via blurry scaling;
    • some games work incorrectly at 4K resolution (e. g. in the “Bionic Commando Rearmed” game, conundrum elements are invisible in “Hack enemy network” sublevels).

    A more powerful GPU cannot help here.

  • From the performance perspective, scaling by pixel duplication should work much faster than using bilinear or bicubic interpolation, so using integer-ratio scaling could descrease or remove a lag introduced by scaling.
  • User has a right not to have unreasonable quality loss when working at resolutions different from the physical resolutions of the display.

Partial solutions

Games

  • Using scaling built into specific full-screen application (e. g. a game). This is typically available only in 2D games: e. g. pixel-art-oriented Owlboy.
  • For scaling 3D games, the freeware GeDoSaTo application can be used. Drawbacks:

    • only supports relatively old games that use DirectX 9 or older;
    • works with just some of them; on some systems;
    • modern versions of the application don’t work at all, yours truly was able to use successfully one of its previous versions — Beta 10 Poltergeist.
  • DgVoodoo (Glide emulator and wrapper for DirectX 8 and older) and DXGL (OpenGL implementation of DirectDraw) reportedly support the nonblurry scaling algorithm “Nearest Neighbour” (sources: 1, 2).

Game-console emulators

  • The emulator of 8/16-bit game consoles higan for Windows since version 104 supports integer-ratio scaling (Settings → Video → Windowed Mode / Fullscreen Mode → Integral scaling). To prevent blur, uncheck the Settings → Video Emulation → Blurring checkbox, and switch the Settings → Video Shader option to the None value instead of the default Blur value.
  • The SNES emulator Snes9x EX+ for Android supports integer-ratio scaling (Options → Video → Zoom → Integer-only). To prevent blur, switch the Options → Video → Image Interpolation option to the None value instead of the default Linear value.

OS virtualization

  • For running DOS applications — the DOSBox emulator with certain settings applied.
  • The freeware virtualization environment VirtualBox supports nonblurry scaling the virtual machine’s screen: Machine → Settings → Display → Screen → Scale Factor.

Viewing images and playing videos

  • For viewing images — the freeware XnView application with the unchecked checkbox Tools → Options → View → High quality zoom → Enlarge. Limitation: the option is applied to all viewed images regardless of ratio of their size to size of the application’s window and using full-screen mode.
  • For playing videos — the freeware MPC-HC player with the setting View → Options → Playback → Output → Resizer → Nearest neighbor. A limitation: the option is applied to all played videos regardless of ratio of their frame size to size of the application’s window and using full-screen mode.

Windows’ built-in features

  • For windowed applications — Windows Magnifier. Drawbacks:

    • unusable user interface — it’s hard to align precisely the scaling area with the bounds of the object to scale;
    • when the size of the object to scale and the monitor’s resolution are not divisible, the area around the object is not filled with a one-color background, so other objects are visible besides the object to scale itself;
    • in windowed mode, there are a lag and some jerkiness.
  • For windowed Windows applications incompatible with HiDPI (non-DPI-aware) — using Windows 10, where, unlike Windows 7, old applications are automatically scaled with no blur at integer Windows zooms.

Miscellaneous

  • To disable unreasonable blur of images on web pages — the SmartUpscale extension for Firefox browser.
  • There is reportedly no blur when using full-screen scaling with integer ratios via the official Intel’s graphics driver for Linux operating system.
  • Some 4K TVs by Panasonic reportedly support displaying Full HD signal with no blur. For example, in the TX-55CX802B model, it is available via the “1080p Pixel by 4 pixels” option in the “Picture → Option Settings” menu. The feature is apparently intended solely for use with Full HD (1920×1080) resolution and does not work at different resolutions of input video signal such as 1280×720. That said, the similar smaller-size model — TX-50CX802 — does not have the feature. A similar feature is reportedly available in the “Graphics” mode in some models of 4K TVs by Sony (e. g. X900E).

Potential solutions

Software

  • Scaling via graphics driver.
  • A monitor emulator that intercepts the image to be displayed on monitor, scales it and displays the scaled image on the physical monitor.
  • Reverse engineering of existing graphics drivers with the purpose of enabling ability to upscale besides already available downscaling in the already available feature — nVidia DSR or AMD VSR.

Hardware

  • Scaling built into monitor itself. The advantage compared with scaling via graphics driver is saving the graphics interface’s bandwidth and potential decrease of electromagnetic radiation from the signal cable.
  • A device inserted between graphics card and monitor. There is a similar device UltraHDMI intended to output video signal of the Nintendo 64 console via HDMI with no loss (review). Such device could probably be based on FPGA: 1, 2. Potential drawbacks:

    • an extra lag is possible;
    • may have a negative impact to compatibility with the HDCP technology required for playing protected content. Solvable with a switch for temporarily enabling the mode of passing-through the unaltered video signal. The switch could be either physical or controllable from computer via USB.

What you can do right now

Regular users

  • Sign the petition on Change.org about implementing nonblurry integer-ratio scaling in graphics drivers.
  • Spread the word about the blur issue to as many people as possible and specify links to the petition and this article.
  • Express your support in corresponding existing threads in forums of GeForce, AMD, Intel, and also on Reddit.
  • Complain of low quality of scaling via graphics driver to GPU vendor’s technical support: nVidia, AMD (1, 2) or Intel (1, 2).

Game developers

  • Built integer-ratio scaling into games developed by them.
  • Lobby adding integer-ratio scaling into popular game engines such as Unreal Engine, Unity, CryEngine, so that games based on them would automatically have the feature.

Progress

Nearest neighbour in nVidia Linux driver 384.47+

The nVidia GeForce graphics driver for Linux, Solaris, and FreeBSD operating systems since version 384.47 () provides the Nearest Neighbour scaling algorithm. It can be enabled with a command like this:

nvidia-settings -a CurrentMetaMode="DP-1: 3840x2160_60 {ViewPortIn=1920x1080, ViewPortOut=3840x2160, ResamplingMethod=Nearest }"

where the DP-1 parameter points to the video output the monitor is connected to, ViewPortIn defines the size of the rendering area in logical pixels, and ViewPortOut corresponds to the size of the resulting scaled image in physical pixels.

Software implementation and performance

The only interpolation available on hardware level in nVidia GPUs is blurry bilinear interpolation, so the nearest neighbour scaling algorithm is implemented in software and uses some GPU power. This can potentially slightly decrease maximum GPU performance.

Incorrect functioning in games

Unfortuntately in many games, the feature works incorrectly: the image is rendered at the ViewPortIn resolution (e. g. Full HD), then upscaled with blur to ViewPortOut resolution (e. g. 4K), then it is cropped to bottom left part corresponding to the ViewPortIn size, and only this cropped part is then output to monitor.

The issue is not specific to a particular desktop environment and takes place at least in Unity (Ubuntu 17.04) and GNOME (Ubuntu 17.10).

One of the driver’s developers Aaron Plattner believes the issue is not with the driver, but with games incorrectly interpreting data received from the RandR software subsystem.

Tested games

Below are results of testing some games at Full HD virtual resolution on the Dell P2415Q monitor with 4K physical resolution under Ubuntu 17.10.

Rendered image is cropped to bottom-left 1/4

Work fine

  • Oddworld New’n’Tasty.
  • Trine 2.
  • Half-Life 2. But menu items do not react to mouse cursor — probably because the real (unlike visible) position of cursor is scaling-ratio-proportionally farther from the top left screen corner.

Other specifics

  • “Euro Truck Simulator 2” runs at 1920×1080 which is output directly to monitor, ignoring/bypassing GPU-powered scaling at all, and therefore there is blur caused by the monitor’s own scaling.
  • “The Cave” works fine in general, but in its settings, 3840×2160 resolution was selected instead of the real effective resolution of 1920×1080. Nothing has changed visually after switching to 1920×1080 except for the formally selected game resolution.

Unavailable in nVidia driver for Windows

The feature is not available in the Windows version of the nVidia GeForce driver.