Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: use combination of point resizing and bicubic scaling to improve image quality #1366

Closed
msikma opened this issue May 21, 2018 · 2 comments · Fixed by #2757
Closed

Comments

@msikma
Copy link

msikma commented May 21, 2018

A short time ago I filed #1364 - but what I actually wanted to file was at the time was this.

At the moment, it seems that EasyRPG uses point resizing. A game window has to be sized a multiple of 320x240 in order to have consistent pixel sizes across the whole image. So when the viewport is slightly off, like in #1364, you get a combination of different pixel sizes in the rendered image:

image

That's why I would recommend the following: use point upscaling to render a buffer at the closest multiple of 320x240 to the viewport size. Then use bicubic scaling to get to the exact viewport size.

In my view, this is the best way to maintain the integrity of pixel art for arbitrary screen sizes.

Here's a comparison of the current behavior, plus an example in which I used point resizing and bicubic resizing:

I'm only checking this on Mac OS X, but I'm not sure on which other platforms this behavior is the same.


Name of the game:

Any.

Player platform:

Mac OS X 10.13.4, but I presume behavior is the same everywhere.

@Ghabry
Copy link
Member

Ghabry commented Aug 14, 2020

POC to implement this: master...Ghabry:sdl-scaling

I removed SDL_RenderSetLogicalSize and did all the calculations manually, otherwise there is not enough control here :/. Makes the code quite long... Not sure if the calculations can be simplified. Also contains multiple equality checks to avoid recalculations/allocations.

There are now two textures:
sdl_texture_game contains the unscaled 320x240 game surface and sdl_texture_scaled which contains the integer/nearest scaled game surface.

sdl_texture_game --(renders int scaled on)--> sdl_texture_scaled --(renders fractional scaled on)--> Display

When the window is a multiple of 320x240 in one dimension only int scaling is done.

FIXME: When the Window is <320x240 nothing is displayed

@Ghabry
Copy link
Member

Ghabry commented Aug 14, 2020

Example: A window slightly larger than 640x480.

Screenshot_20200814_162554-fs8

Though this also reduces the sharpness so there should be a way to configure this.

Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Mar 29, 2022
1. When the window is not an integer aspect ratio create an intermediate texture that is one scale factor higher than the window
2. Then Blit on it with nearest neighbour
3. Then Blit on the screen with bilinear downscale

Fix EasyRPG#1366
Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Mar 29, 2022
1. When the window is not an integer aspect ratio create an intermediate texture that is one scale factor higher than the window
2. Then Blit on it with nearest neighbour
3. Then Blit on the screen with bilinear downscale

Fix EasyRPG#1366
Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Mar 29, 2022
1. When the window is not an integer aspect ratio create an intermediate texture that is one scale factor higher than the window
2. Then Blit on it with nearest neighbour
3. Then Blit on the screen with bilinear downscale

Fix EasyRPG#1366
@fdelapena fdelapena added this to the 0.7.1 milestone Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants