Gliden64: Feature request: interger or nearest neighbor scaling for non output resolutions

Created on 19 Sep 2019  路  13Comments  路  Source: gonetz/GLideN64

Any resolution selected that isn't the windows resolution gets blury at least on my system and the only plugin that does this is angrylion/plus. it would be nice to have a hardware accelerated solution to this
GlideN64
image

AngryLionPlus
image

Most helpful comment

I made an experimental branch for this task.
Here I use hybrid texture filter implemented for task #2116 in Video Interface to draw frame buffer image to screen. Branch name 2088_hybrid_filter. I need your feedback. Where to look? I made comparison screen shots for Paper Mario subscreen. The game runs in native resolution, screen resolution is 1080p.

  • Current master, bilinear
    GLideN64_PAPER_MARIO_000
  • Hacked to force nearest-neighbor
    GLideN64_PAPER_MARIO_001
  • Branch, hybrid filter
    GLideN64_PAPER_MARIO_002

Lets look closely to "Boots":
Boots

It illustrates all the problems with image scaling described in the article
https://colececil.io/blog/2017/scaling-pixel-art-without-destroying-it/

Bilinear is blurry, but no image distortion. Nearest-neighbor is distorted (look at o in Boots). Hybrid is not that sharp as Nearest-neighbor but not that distorted as well.

All 13 comments

Maybe as an addendum to ticket #2082 but yeah it would be cool to draw the output surface with nearest neighbor and rounded to the nearest integer so all pixels are proportional (esp. for pixel art games). Gonetz is overworked with other stuff atm so it might not be in soon

According to this thread, setting was accessible through .ini at one point.
https://github.com/gonetz/GLideN64/issues/2082
EDIT: lol i'm an idiot it's referenced in the issue

Angrylion looks like native resolution upscaled to windows resolution with nearest neighbor. Maybe it should be possible to select bilinear or nearest neighbor upscaling if nativresfactor != 0.

a work around ive found is reshade with this shader https://www.dropbox.com/s/jo9nsw5wb19nghy/VirtualResolution.fx?dl=0

agree with this one. the current upscaling from low (eg 1x native resolution) to fullscreen (eg, 1080p), is quite ugly and usually not what you'd want. nearest neighbour would be a great option!

I made an experimental branch for this task.
Here I use hybrid texture filter implemented for task #2116 in Video Interface to draw frame buffer image to screen. Branch name 2088_hybrid_filter. I need your feedback. Where to look? I made comparison screen shots for Paper Mario subscreen. The game runs in native resolution, screen resolution is 1080p.

  • Current master, bilinear
    GLideN64_PAPER_MARIO_000
  • Hacked to force nearest-neighbor
    GLideN64_PAPER_MARIO_001
  • Branch, hybrid filter
    GLideN64_PAPER_MARIO_002

Lets look closely to "Boots":
Boots

It illustrates all the problems with image scaling described in the article
https://colececil.io/blog/2017/scaling-pixel-art-without-destroying-it/

Bilinear is blurry, but no image distortion. Nearest-neighbor is distorted (look at o in Boots). Hybrid is not that sharp as Nearest-neighbor but not that distorted as well.

pie

Just from your example I noticed
Nearest vs Hybrid. Hybrid fixes the uneven pixels in letter P from "Pieces"

Maybe neareast option should be kept for low end devices (read: gles2), although I doubt this filter would be much of a slowdown? As it currently stands, the codepath for gles2 doesn't even use this filter. The reference implementation of the hybrid filter says

#if __VERSION__ < 130
/* For this verison to work, you need to extract the texture dimensions:
 *
 *     GLint width, height;
 *     glGetTexLevelParameteriv(0, 0, GL_TEXTURE_WIDTH, &width);
 *     glGetTexLevelParameteriv(0, 0, GL_TEXTURE_HEIGHT, &height);
 *
 * then  tell the shader:
 *
 *     glUniform2iv(glGetUniformLocation(shader_program, "texture_size"),
 *                  width, height);
 */
uniform ivec2 texture_size;

ivec2 get_texture_size(sampler2D tex)
{
#if __VERSION__ < 130
    return texture_size;
#else
    return textureSize(tex, 0);
#endif
}

so making it work for gles2 is just a matter of making this change. no?
Btw, it looks amazing with every game I've tried! Angrylion level quality (with VI filters disabled). Awesome!

Maybe neareast option should be kept for low end devices (read: gles2)

I set nearest filter instead of linear for frame buffer textures. Since hybrid is disabled for GLES2, it will use plain nearest atm.

so making it work for gles2 is just a matter of making this change. no?

Yes.

Done in 488d52d
@AriaHiro64 please test the latest WIP build from AppVeyor. If it is what you need, please close this issue.

image
yep this issue can be closed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gonetz picture gonetz  路  10Comments

ImSpecial picture ImSpecial  路  10Comments

gonetz picture gonetz  路  14Comments

kcghost picture kcghost  路  10Comments

NurioHin picture NurioHin  路  10Comments