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:
parent
1c5776d13a
commit
4c4e296274
8 changed files with 70 additions and 65 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue