Page 1 of 1

Support Nearest scaling — supported by Unreal Engine — for no quality loss at non-native resolutions

Posted: Fri Apr 06, 2018 11:52 am
by MT_
It would be nice for GRIP to have built-in integer-ratio upscaling with no blur. This would allow to play with no quality loss e.g. at Full-HD (1920×1080) resolution on a 4K (3840×2160) monitor for much higher performance. Let’s make GRIP outstanding.

Unreal Engine the GRIP game is based on supports Nearest-Neighbour upscaling via `r.Upscale.Quality` console variable set to `0`.

The game already has the “Resolution scale” option. We basically just need to make it nonblurry at 50% and 25%.

This image shows the difference between how monitors and GPUs currently do upscaling (to the left) and what we need instead (to the right):


Extremely demanded by 4K-monitor owners

The feature is extremely demanded by 4K-monitor owners. There are a corresponding petition signed by almost 1500 people, and nVidia (50+ pages), AMD and Intel forum threads.

Given that no commercial 3D game has the feature, the feature would make the GRIP game OUTSTANDING compared with all other games.

Live demo and algorithm

Please see also the live demo that allows to view any image with both types of scaling and the article that explains the issue in detail and attempts to collect and summarize all the relevant information. The article also has the “Algorithm” section that describes in detail how to implement integer-ratio scaling.

For example, 1920×1080 (Full HD) could be upscaled to 3840×2160 (4K) with NO BLUR by representing each logical pixel as a group of exactly 4 (2×2) physical pixels of the SAME COLOR, unlike always-blurry scaling built into monitors and graphics drivers.

In the same way, 640×480 could be upscaled to 2560×1920 (with each logical pixel displayed as a group of 4×4 IDENTICAL physical pixels), the resulting image centered on the screen, and the rest space (640+640 horizontally and 120+120 vertically) filled-in with black.

How to implement — Render-To-Texture

In 3D games, the feature can be implemented with the “Render-To-Texture technique and performant GPU-accelerated upscaling of the resulting texture using the “Nearest Neighbour” algorithm.

Supported by Unreal Engine

Unreal Engine supports Nearest-Neighbour upscaling via the `r.Upscale.Quality` console variable set to `0`. At integer scaling ratios, the “Nearest Neighbour” algorithm gives the same nonblurry undistorted result as integer-ratio scaling.

QuakeSpasm is a real-world example

A real-world example of the feature implemented in a 3D game is QuakeSpasm 0.93.0+ (an open-source engine for Quake) where the `r_scale` configuration option specifies a ratio that the resolution chosen in game settings should be divided by.

For example, with `r_scale` set to 2 and game resolution set to 3840×2160, in-game 3D scenes are effectively rendered at 1920×1080 (2-times smaller by each dimension than 3840×2160) and then upscaled to 3840×2160 using the “Nearest Neighbour” algorithm with no blur.

Afaict, the `r_scale` feature is handled by the `R_ScaleView()` (`void R_ScaleView (void)`) function in the "Quake/gl_rmain.c" file (line 968 for trunk version 1576).