Description
Issue type
- Feature request
Minetest version
Minetest 0.5.0-dev (Linux)
Using Irrlicht 1.8.4
BUILD_TYPE=None
RUN_IN_PLACE=0
USE_GETTEXT=1
USE_SOUND=1
USE_CURL=1
USE_FREETYPE=1
USE_LUAJIT=1
STATIC_SHAREDIR="/usr/share/minetest"
OS / Hardware
Operating system: Lubuntu 17.10
CPU: intel
GPU model: intel graphics chip
OpenGL version: 4.5 (Core Profile) Mesa 17.4.0-devel - padoka PPA
Summary
I think the algorithm I tried for mipmapping (#6917) works great for oversampling.
Please view the screenshots in 1:1 resolution or with nearest neighbour upscaling (integer or big scaling factor).
nearest neighbour downscaled (corresponds most to no oversampling):
As you can see, oversampling with this downscaling algorithm
- increases details, see the tulip,
- rids Moire-effects (see the bricks (I shouldn't have used mipmapping here…)),
if mipmapping is used, there're more details instead of Moire effect reduction, - has an anti-aliasing effect,
- does not smooth the image (or insignificantly), this would happen with linear or bicubic downscaling
It can be implemented with parallelization (shaders), the speed of the algorithm lies between linear and bicubic downscaling.
Also, if implemented on the gpu it maybe doesn't have a noticeable performance impact because minetest is cpu-intensive.
A window resolution threshold setting could be added so that oversampling is only enabled when the resolution is low enough. 2x oversampling means four times as many pixels need to be rendered (in addition to the downscaling overhead) and fortunately oversampling is especially useful when the game is rendering for low resolution output.
Additional informations
Here is a list of some implementations of SSIM-based perceptual downscaling:
- A Shader for mpv: https://gist.github.com/igv/36508af3ffc84410fe39761d6969be10
- My implementation in C: https://gist.github.com/HybridDog/dd95a99d411972f030fb18543280ad60
- My implementation for SSAA in Minetest: https://github.com/HybridDog/minetest/tree/m_oversampling_new