Skip to content

Commit 4b5d4be

Browse files
#3106 Lower maximum texture bias back to 4, reintroduce camera importance texture scaling (#3207)
1 parent 27fb297 commit 4b5d4be

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

indra/newview/app_settings/settings.xml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11433,30 +11433,17 @@
1143311433
<key>Value</key>
1143411434
<real>20.0</real>
1143511435
</map>
11436-
<key>TextureBiasDistanceScale</key>
11436+
<key>TextureCameraBoost</key>
1143711437
<map>
1143811438
<key>Comment</key>
11439-
<string>When biasing textures to lower resolution due to lack of vram, weight to put on distance factor.</string>
11439+
<string>Amount to boost resolution of textures that are important to the camera.</string>
1144011440
<key>Persist</key>
11441-
<integer>1</integer>
11441+
<integer>0</integer>
1144211442
<key>Type</key>
1144311443
<string>F32</string>
1144411444
<key>Value</key>
1144511445
<real>8.0</real>
1144611446
</map>
11447-
<key>TextureBiasUnimportantFactor</key>
11448-
<map>
11449-
<key>Comment</key>
11450-
<string>When biasing textures to lower resolution due to lack of vram, the importance threshold below which is considered unimportant and getting an extra bias.</string>
11451-
<key>Persist</key>
11452-
<integer>1</integer>
11453-
<key>Type</key>
11454-
<string>F32</string>
11455-
<key>Value</key>
11456-
<real>0.25</real>
11457-
<key>Backup</key>
11458-
<integer>0</integer>
11459-
</map>
1146011447
<key>TextureDecodeDisabled</key>
1146111448
<map>
1146211449
<key>Comment</key>

indra/newview/llviewertexture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ void LLViewerTexture::updateClass()
621621
}
622622
}
623623

624-
sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 5.f);
624+
sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 4.f);
625625

626626
LLViewerTexture::sFreezeImageUpdates = false;
627627
}

indra/newview/llviewertexturelist.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,6 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
891891

892892
if (imagep->getBoostLevel() < LLViewerFetchedTexture::BOOST_HIGH) // don't bother checking face list for boosted textures
893893
{
894-
static LLCachedControl<F32> bias_distance_scale(gSavedSettings, "TextureBiasDistanceScale", 1.f);
895894
static LLCachedControl<F32> texture_scale_min(gSavedSettings, "TextureScaleMinAreaFactor", 0.04f);
896895
static LLCachedControl<F32> texture_scale_max(gSavedSettings, "TextureScaleMaxAreaFactor", 25.f);
897896

@@ -900,7 +899,12 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
900899

901900
U32 face_count = 0;
902901

903-
F32 bias = (F32) llroundf(powf(4, LLViewerTexture::sDesiredDiscardBias - 1.f));
902+
// get adjusted bias based on image resolution
903+
F32 max_discard = F32(imagep->getMaxDiscardLevel());
904+
F32 bias = llclamp(max_discard - 2.f, 1.f, LLViewerTexture::sDesiredDiscardBias);
905+
906+
// convert bias into a vsize scaler
907+
bias = (F32) llroundf(powf(4, bias - 1.f));
904908

905909
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
906910
for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
@@ -914,7 +918,6 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
914918
++face_count;
915919
F32 radius;
916920
F32 cos_angle_to_view_dir;
917-
static LLCachedControl<F32> bias_unimportant_threshold(gSavedSettings, "TextureBiasUnimportantFactor", 0.25f);
918921

919922
if ((gFrameCount - face->mLastTextureUpdate) > 10)
920923
{ // only call calcPixelArea at most once every 10 frames for a given face
@@ -948,6 +951,13 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
948951
vsize /= bias;
949952
}
950953

954+
// boost resolution of textures that are important to the camera
955+
if (face->mInFrustum)
956+
{
957+
static LLCachedControl<F32> texture_camera_boost(gSavedSettings, "TextureCameraBoost", 8.f);
958+
vsize *= llmax(face->mImportanceToCamera*texture_camera_boost, 1.f);
959+
}
960+
951961
max_vsize = llmax(max_vsize, vsize);
952962
}
953963
}

0 commit comments

Comments
 (0)