diff options
author | Cosmic Linden <cosmic@lindenlab.com> | 2024-03-20 17:07:44 -0700 |
---|---|---|
committer | Cosmic Linden <cosmic@lindenlab.com> | 2024-03-20 17:07:44 -0700 |
commit | 96933d05ec8af6e9b5e8cee11c18232027e74ff5 (patch) | |
tree | d17937d40c8f9b4cdd6f39544c74d3ccb5f83961 /indra | |
parent | 3afb104199cb31de8e5f02e51a3c9f69e58ee248 (diff) |
secondlife/viewer#1027: Fix noise on transparent PBR materials on minimap
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llvlcomposition.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index 506ab005c5..6b42804a90 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -42,6 +42,8 @@ #include "llviewercontrol.h" +extern LLColor4U MAX_WATER_COLOR; + static const U32 BASE_SIZE = 128; F32 bilinear(const F32 v00, const F32 v01, const F32 v10, const F32 v11, const F32 x_frac, const F32 y_frac) @@ -480,6 +482,7 @@ BOOL LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, LLViewerFetchedTexture* tex_emissive; // Can be null bool has_base_color_factor; bool has_emissive_factor; + bool has_alpha; LLColor3 base_color_factor; LLColor3 emissive_factor; if (use_textures) @@ -488,6 +491,7 @@ BOOL LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, tex_emissive = nullptr; has_base_color_factor = false; has_emissive_factor = false; + has_alpha = false; llassert(tex); } else @@ -504,6 +508,7 @@ BOOL LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, has_emissive_factor = (emissive_factor.mV[VX] != 1.f || emissive_factor.mV[VY] != 1.f || emissive_factor.mV[VZ] != 1.f); + has_alpha = mDetailMaterials[i]->mAlphaMode != LLGLTFMaterial::ALPHA_MODE_OPAQUE; } if (!tex) { tex = LLViewerFetchedTexture::sWhiteImagep; } @@ -588,11 +593,21 @@ BOOL LLVLComposition::generateMinimapTileLand(const F32 x, const F32 y, } if (has_base_color_factor || raw_emissive || + has_alpha || tex->getWidth(ddiscard) != BASE_SIZE || tex->getHeight(ddiscard) != BASE_SIZE || tex->getComponents() != 3) { LLPointer<LLImageRaw> newraw = new LLImageRaw(BASE_SIZE, BASE_SIZE, 3); + if (has_alpha) + { + // Approximate the water underneath terrain alpha with solid water color + newraw->clear( + MAX_WATER_COLOR.mV[VX], + MAX_WATER_COLOR.mV[VY], + MAX_WATER_COLOR.mV[VZ], + 255); + } newraw->composite(mRawImages[i]); if (has_base_color_factor) { |