summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexturelist.cpp
diff options
context:
space:
mode:
authorBeq Janus <beqjanus@gmail.com>2024-07-02 18:57:39 +0100
committerGitHub <noreply@github.com>2024-07-02 12:57:39 -0500
commit475d0df4c152972665c978f7b0991f8726def03a (patch)
tree3d50a17855343196423382a741096f010f1e305a /indra/newview/llviewertexturelist.cpp
parent886be2faf19343843d8b2bf7a24c91bdeb1a9294 (diff)
Experimental fix for blurry textures (#1875)
This change removes the distance based bias (which is a large contributor to premature blurring) but adds a check using the importance factor to give some balance. importance should be between 0 and 1 and is higher when the texture is facing the camera, lower when it is side on, The unimportance setting defines the cutoff vaklue below which we'll consider the textures worth "down scaling" by the bias factor. The setting is inplace to allow us to play with this, 0.25 is current default. Note this change moves the calcPixelArea() call to the top BEFORE we user getPixelArea(). Either that call is entirely redundant (i.e. if calc was called earlier in the frame) or we were using the stale pixelArea (one frame behind). If the former is true then it might be faster to just do an AABB frustum check.
Diffstat (limited to 'indra/newview/llviewertexturelist.cpp')
-rw-r--r--indra/newview/llviewertexturelist.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 4d8fd8ddd5..2f685474e1 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -931,6 +931,10 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
if (face && face->getViewerObject() && face->getTextureEntry())
{
+ F32 radius;
+ F32 cos_angle_to_view_dir;
+ BOOL in_frustum = face->calcPixelArea(cos_angle_to_view_dir, radius);
+ static LLCachedControl<F32> bias_unimportant_threshold(gSavedSettings, "TextureBiasUnimportantFactor", 0.25f);
F32 vsize = face->getPixelArea();
// Scale desired texture resolution higher or lower depending on texture scale
@@ -944,13 +948,7 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
min_scale = llclamp(min_scale*min_scale, texture_scale_min(), texture_scale_max());
vsize /= min_scale;
- vsize /= LLViewerTexture::sDesiredDiscardBias;
- vsize /= llmax(1.f, (LLViewerTexture::sDesiredDiscardBias-1.f) * (1.f + face->getDrawable()->mDistanceWRTCamera * bias_distance_scale));
-
- F32 radius;
- F32 cos_angle_to_view_dir;
- bool in_frustum = face->calcPixelArea(cos_angle_to_view_dir, radius);
- if (!in_frustum || !face->getDrawable()->isVisible())
+ if (!in_frustum || !face->getDrawable()->isVisible() || face->getImportanceToCamera() < bias_unimportant_threshold)
{ // further reduce by discard bias when off screen or occluded
vsize /= LLViewerTexture::sDesiredDiscardBias;
}