ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.74k stars 629 forks source link

(feature request) Use Bicubic filtering in OpenGL instead of Bilinear (makes filtered textures less blurry) #3462

Open Deus-nsf opened 1 year ago

Deus-nsf commented 1 year ago

Not sure about the feasibility of this, but it would make texture filtering look significantly better. Also in the meantime, please use gl_texturemode GL_NEAREST_MIPMAP_LINEAR instead of just GL_NEAREST for the non filtered texture option, as it's going to look generally much better (or provide 2 options for people who still want pixelated sxyboxes).

kisak-valve commented 1 year ago

Hello @Deus-nsf, this issue is already being tracked at #2606 / #2978.

Closing as a duplicate.

Deus-nsf commented 1 year ago

It's not really a duplicate, the skybox thing was more of a suggestion, I'm glad it's being tracked but my feature request was about using a Bicubic filtering technique to replace the current Bilinear one :)

SirYodaJedi commented 1 year ago

If you do implement this, please make it optional; bicubic does sharpening (as do most algorithms other than the current nearest and bilinear), which causes ghosting artefacts which are particularly ugly at lower resolutions.

Deus-nsf commented 1 year ago

If you do implement this, please make it optional; bicubic does sharpening (as do most algorithms other than the current nearest and bilinear), which causes ghosting artefacts which are particularly ugly at lower resolutions.

Lanczos does it but bicubic is fine, at least from what I saw in samples so far?

SirYodaJedi commented 1 year ago

Lanczos does it but bicubic is fine, at least from what I saw in samples so far?

Lanczos does it more aggressively than bicubic, but both do sharpening. Certain color combinations make the ghosting more obvious than others; there's a great comparison from a couple decades ago here. Despite the sharpening, bicubic can also be blurrier than bilinear; it's effective at reducing jaggies, sure, but at the cost of detail retention.

L1pE commented 1 year ago

FWIW, I tested the image in that link in Krita and ImageMagick, the only algo less blurry than bilinear without presenting sharpening artifacts was hermite: resizetestherm EDIT: Actually bilinear only looks ok when rescaling to 2x or 3x and such, at more extreme rescaling many other algos look better. Examples: https://matplotlib.org/mpl_examples/images_contours_and_fields/interpolation_methods.hires.png and https://matplotlib.org/3.3.1/_images/sphx_glr_interpolation_methods_001.png

Deus-nsf commented 1 year ago

All I know is Mirror's Edge 2008 (running on Unreal Engine 3) uses Bicubic texture filtering if I'm not mistaken, and it looks really great. It has this subtle sharpening effect if you're really looking for it but it generally looks better than bilinear.

Deus-nsf commented 6 months ago

FWIW, I tested the image in that link in Krita and ImageMagick, the only algo less blurry than bilinear without presenting sharpening artifacts was hermite: resizetestherm EDIT: Actually bilinear only looks ok when rescaling to 2x or 3x and such, at more extreme rescaling many other algos look better. Examples: https://matplotlib.org/mpl_examples/images_contours_and_fields/interpolation_methods.hires.png and https://matplotlib.org/3.3.1/_images/sphx_glr_interpolation_methods_001.png

Hermite / Kaiser look like the real deal!