1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-05 19:31:04 +00:00

Handle texture filtering sanely to avoid blurriness (#16034)

This commit is contained in:
sfan5 2025-04-21 12:31:44 +02:00 committed by GitHub
parent 1c5776d13a
commit 4c4e296274
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 70 additions and 65 deletions

View file

@ -281,12 +281,11 @@ void WieldMeshSceneNode::setExtruded(const std::string &imagename,
material.MaterialType = m_material_type;
material.MaterialTypeParam = 0.5f;
material.BackfaceCulling = true;
// Enable bi/trilinear filtering only for high resolution textures
bool bilinear_filter = dim.Width > 32 && m_bilinear_filter;
bool trilinear_filter = dim.Width > 32 && m_trilinear_filter;
// don't filter low-res textures, makes them look blurry
bool f_ok = std::min(dim.Width, dim.Height) >= TEXTURE_FILTER_MIN_SIZE;
material.forEachTexture([=] (auto &tex) {
setMaterialFilters(tex, bilinear_filter, trilinear_filter,
m_anisotropic_filter);
setMaterialFilters(tex, m_bilinear_filter && f_ok,
m_trilinear_filter && f_ok, m_anisotropic_filter);
});
// mipmaps cause "thin black line" artifacts
material.UseMipMaps = false;