Interrupt / systemshock

Shockolate - A minimalist and cross platform System Shock source port.
GNU General Public License v3.0
803 stars 62 forks source link

UI bilinear filtering #288

Open HunterZ opened 5 years ago

HunterZ commented 5 years ago

It would be great if bilinear filtering could (optionally?) be applied to scaled menus and UI elements.

HunterZ commented 5 years ago

Bad news:

The game scales all UI elements in software. Look for usages of SCONV_X() & SCONV_Y() macros. It would take a fair amount of effort to change it to render pixel-perfect and then have SDL do the upscaling so that it can decide whether to apply filtering.

There's also another weird layer of scaling going on: The OpenGL and 2D portions of the screen are rendered at the resolution selected from the in-game video option, then SDL composites them and scales them to the real game window size. It's possible to have SDL apply bilinear filtering to this scaling operation by adding SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear"); before creating the texture in SDLDraw() in Shock.c, but this has minimal effect when rendering at 1024x768 and scaling to 1080p, and it doesn't seem to affect the OpenGL portion of the scene at all.

Here what I think would be a better solution:

This should result in an increased fidelity for minimap, text, pointer lines, and OpenGL scene rendering, and smoother look for the remaining 2D elements.

Unfortunately doing this is currently way over my head, so I'll just leave these ideas here for now.