From 4b5d4be5a86af035ec756bcbdb3aeafbf90f5d10 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 4 Dec 2024 10:33:04 -0800 Subject: #3106 Lower maximum texture bias back to 4, reintroduce camera importance texture scaling (#3207) --- indra/newview/app_settings/settings.xml | 19 +++---------------- indra/newview/llviewertexture.cpp | 2 +- indra/newview/llviewertexturelist.cpp | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 65235b47af..1ea08498c5 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11433,30 +11433,17 @@ Value 20.0 - TextureBiasDistanceScale + TextureCameraBoost Comment - When biasing textures to lower resolution due to lack of vram, weight to put on distance factor. + Amount to boost resolution of textures that are important to the camera. Persist - 1 + 0 Type F32 Value 8.0 - TextureBiasUnimportantFactor - - Comment - When biasing textures to lower resolution due to lack of vram, the importance threshold below which is considered unimportant and getting an extra bias. - Persist - 1 - Type - F32 - Value - 0.25 - Backup - 0 - TextureDecodeDisabled Comment diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 36cc9bf88f..e14ddc4360 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -621,7 +621,7 @@ void LLViewerTexture::updateClass() } } - sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 5.f); + sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 4.f); LLViewerTexture::sFreezeImageUpdates = false; } diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 2dc0458d99..b44bedea50 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -891,7 +891,6 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag if (imagep->getBoostLevel() < LLViewerFetchedTexture::BOOST_HIGH) // don't bother checking face list for boosted textures { - static LLCachedControl bias_distance_scale(gSavedSettings, "TextureBiasDistanceScale", 1.f); static LLCachedControl texture_scale_min(gSavedSettings, "TextureScaleMinAreaFactor", 0.04f); static LLCachedControl texture_scale_max(gSavedSettings, "TextureScaleMaxAreaFactor", 25.f); @@ -900,7 +899,12 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag U32 face_count = 0; - F32 bias = (F32) llroundf(powf(4, LLViewerTexture::sDesiredDiscardBias - 1.f)); + // get adjusted bias based on image resolution + F32 max_discard = F32(imagep->getMaxDiscardLevel()); + F32 bias = llclamp(max_discard - 2.f, 1.f, LLViewerTexture::sDesiredDiscardBias); + + // convert bias into a vsize scaler + bias = (F32) llroundf(powf(4, bias - 1.f)); LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE; for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i) @@ -914,7 +918,6 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag ++face_count; F32 radius; F32 cos_angle_to_view_dir; - static LLCachedControl bias_unimportant_threshold(gSavedSettings, "TextureBiasUnimportantFactor", 0.25f); if ((gFrameCount - face->mLastTextureUpdate) > 10) { // only call calcPixelArea at most once every 10 frames for a given face @@ -948,6 +951,13 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag vsize /= bias; } + // boost resolution of textures that are important to the camera + if (face->mInFrustum) + { + static LLCachedControl texture_camera_boost(gSavedSettings, "TextureCameraBoost", 8.f); + vsize *= llmax(face->mImportanceToCamera*texture_camera_boost, 1.f); + } + max_vsize = llmax(max_vsize, vsize); } } -- cgit v1.2.3