summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2026-05-18 13:40:59 -0400
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2026-05-18 13:40:59 -0400
commit1b1f59c1e21581c4c1968b9206b9d9c0dc8513a1 (patch)
treee86d63fdd61d96a416a7e89cae30142291b8cbd8
parent97bcc7816d7084b4aaed67cdb90a5b7ae0ec1126 (diff)
Break out texture channel priorities.
-rw-r--r--indra/newview/app_settings/settings.xml48
-rw-r--r--indra/newview/llviewercontrol.cpp24
-rw-r--r--indra/newview/llviewertexture.cpp15
-rw-r--r--indra/newview/llviewertexture.h3
-rw-r--r--indra/newview/llviewertexturelist.cpp6
-rw-r--r--indra/newview/llviewertexturelist.h4
6 files changed, 71 insertions, 29 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 35b3665bec..8559fa4ac3 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -8016,7 +8016,7 @@
<key>RenderTextureQuality</key>
<map>
<key>Comment</key>
- <string>Texture quality preset: 0=Low, 1=Medium, 2=High, 3=Ultra. Drives RenderMaxTextureResolution and TextureChannelPriority.</string>
+ <string>Texture quality preset: 0=Low, 1=Medium, 2=High, 3=Ultra. Drives RenderMaxTextureResolution, the four TextureChannel* exponents, and TextureDistanceDiscardPower.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@@ -11816,21 +11816,49 @@
<key>Value</key>
<real>20.0</real>
</map>
- <key>TextureChannelPriority</key>
+ <key>TextureChannelNormal</key>
<map>
<key>Comment</key>
- <string>Per-channel exponent on the combined discard factor. X=normals, Y=diffuse, Z=spec, W=emissive. 1.0 = baseline; lower = more aggressive. Driven by the RenderTextureQuality preset.</string>
+ <string>Per-channel discard exponent for normal maps. 1.0 = baseline; lower = more aggressive. Driven by the RenderTextureQuality preset.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
- <string>Vector4</string>
+ <string>F32</string>
<key>Value</key>
- <array>
- <real>1.0</real>
- <real>0.75</real>
- <real>0.5</real>
- <real>0.75</real>
- </array>
+ <real>1.0</real>
+ </map>
+ <key>TextureChannelBaseColor</key>
+ <map>
+ <key>Comment</key>
+ <string>Per-channel discard exponent for base color / diffuse. 1.0 = baseline; lower = more aggressive. Driven by the RenderTextureQuality preset.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.75</real>
+ </map>
+ <key>TextureChannelSpecular</key>
+ <map>
+ <key>Comment</key>
+ <string>Per-channel discard exponent for specular / metallic-roughness. 1.0 = baseline; lower = more aggressive. Driven by the RenderTextureQuality preset.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.5</real>
+ </map>
+ <key>TextureChannelEmissive</key>
+ <map>
+ <key>Comment</key>
+ <string>Per-channel discard exponent for emissive. 1.0 = baseline; lower = more aggressive. Driven by the RenderTextureQuality preset.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.75</real>
</map>
<key>TextureMaxDiscardOverride</key>
<map>
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 3a6e4e2e2d..a4a7f1fd20 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -114,36 +114,42 @@ static bool handleRenderAvatarMouselookChanged(const LLSD& newvalue)
static bool handleRenderTextureQualityChanged(const LLSD& newvalue)
{
- // 0=Low, 1=Medium, 2=High, 3=Ultra. Drives max-resolution and the
- // per-channel TextureChannelPriority + TextureDistanceDiscardPower
- // exponents. Channel order: X=normals, Y=diffuse, Z=spec, W=emissive.
+ // 0=Low, 1=Medium, 2=High, 3=Ultra. Drives RenderMaxTextureResolution,
+ // the four TextureChannel* exponents (Normal/BaseColor/Spec/Emissive),
+ // and TextureDistanceDiscardPower.
U32 quality = (U32)newvalue.asInteger();
U32 max_res = 2048;
- LLVector4 channel_priority(1.f, 0.75f, 0.5f, 0.75f);
+ F32 ch_normal = 1.0f;
+ F32 ch_basecolor = 0.75f;
+ F32 ch_specular = 0.5f;
+ F32 ch_emissive = 0.75f;
F32 distance_power = 0.5f;
switch (quality)
{
case 0: // Low
max_res = 1024;
- channel_priority.setVec(0.5f, 0.75f, 0.1f, 0.5f);
+ ch_normal = 0.5f; ch_basecolor = 0.75f; ch_specular = 0.1f; ch_emissive = 0.5f;
distance_power = 0.15f;
break;
case 1: // Medium
- channel_priority.setVec(0.75f, 0.75f, 0.3f, 0.75f);
+ ch_normal = 0.75f; ch_basecolor = 0.75f; ch_specular = 0.3f; ch_emissive = 0.75f;
distance_power = 0.25f;
break;
case 2: // High
- // channel defaults above (1, 0.75, 0.5, 0.75)
+ // channel defaults above
distance_power = 0.35f;
break;
case 3: // Ultra
default:
- channel_priority.setVec(1.f, 1.f, 1.f, 1.f);
+ ch_normal = 1.f; ch_basecolor = 1.f; ch_specular = 1.f; ch_emissive = 1.f;
distance_power = 0.5f;
break;
}
gSavedSettings.setU32("RenderMaxTextureResolution", max_res);
- gSavedSettings.setVector4("TextureChannelPriority", channel_priority);
+ gSavedSettings.setF32("TextureChannelNormal", ch_normal);
+ gSavedSettings.setF32("TextureChannelBaseColor", ch_basecolor);
+ gSavedSettings.setF32("TextureChannelSpecular", ch_specular);
+ gSavedSettings.setF32("TextureChannelEmissive", ch_emissive);
gSavedSettings.setF32("TextureDistanceDiscardPower", distance_power);
return true;
}
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 1e8951926e..727c0510f6 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -3180,10 +3180,19 @@ void LLViewerLODTexture::processTextureStats()
// Per-channel exponent. 1.0 = baseline; <1.0 pushes combined
// toward 1 (max attenuation) faster. Edges are preserved:
// pow(0, p) = 0, pow(1, p) = 1.
+ // mPriorityChannel order: 0=Normal, 1=BaseColor, 2=Specular, 3=Emissive.
S32 priority_channel = (mPriorityChannel >= 0 && mPriorityChannel < 4) ? (S32)mPriorityChannel : 1;
- static LLCachedControl<LLVector4> channel_priority(gSavedSettings, "TextureChannelPriority",
- LLVector4(1.f, 1.f, 1.f, 1.f));
- F32 channel_power = llmax(channel_priority().mV[priority_channel], 0.0001f);
+ static LLCachedControl<F32> channel_normal (gSavedSettings, "TextureChannelNormal", 1.0f);
+ static LLCachedControl<F32> channel_basecolor(gSavedSettings, "TextureChannelBaseColor", 0.75f);
+ static LLCachedControl<F32> channel_specular (gSavedSettings, "TextureChannelSpecular", 0.5f);
+ static LLCachedControl<F32> channel_emissive (gSavedSettings, "TextureChannelEmissive", 0.75f);
+ const F32 channels[4] = {
+ (F32)channel_normal,
+ (F32)channel_basecolor,
+ (F32)channel_specular,
+ (F32)channel_emissive,
+ };
+ F32 channel_power = llmax(channels[priority_channel], 0.0001f);
if (channel_power != 1.f)
{
combined = powf(combined, channel_power);
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index f4770e5fac..e2215700c0 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -203,8 +203,7 @@ protected:
mutable S32 mMaxVirtualSizeResetInterval;
LLFrameTimer mLastReferencedTimer;
- // Index into TextureChannelPriority Vector4 (X=normals, Y=diffuse,
- // Z=spec, W=emissive). -1 -> fall back to diffuse.
+ // 0=Normal, 1=BaseColor, 2=Specular, 3=Emissive. -1 -> base color.
S8 mPriorityChannel = -1;
// Bind-staleness floor, 0..1. Per-interval increment is 1/max_discard
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index d555cd21db..2e66dc2a11 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -96,9 +96,9 @@ LLTextureKey::LLTextureKey(LLUUID id, ETexListType tex_type)
///////////////////////////////////////////////////////////////////////////////
-// eTexIndex -> TextureChannelPriority component index (X=normals, Y=diffuse,
-// Z=spec, W=emissive). Single source of truth - route all channel-priority
-// lookups through this table.
+// eTexIndex -> TextureChannel* index (0=Normal, 1=BaseColor, 2=Specular,
+// 3=Emissive). Single source of truth - route all channel-priority lookups
+// through this table.
const S32 LLViewerTextureList::sChannelToPriority[LLRender::NUM_TEXTURE_CHANNELS] =
{
1, // DIFFUSE_MAP (0) -> Y (diffuse)
diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h
index dd8655cd6f..931f2ed50e 100644
--- a/indra/newview/llviewertexturelist.h
+++ b/indra/newview/llviewertexturelist.h
@@ -93,8 +93,8 @@ class LLViewerTextureList
friend class LLLocalBitmap;
public:
- // eTexIndex -> TextureChannelPriority component (X=normals, Y=diffuse,
- // Z=spec, W=emissive). Single source of truth.
+ // eTexIndex -> TextureChannel* index (0=Normal, 1=BaseColor,
+ // 2=Specular, 3=Emissive). Single source of truth.
static const S32 sChannelToPriority[LLRender::NUM_TEXTURE_CHANNELS];
static bool createUploadFile(LLPointer<LLImageRaw> raw_image,