summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <akleshchev@productengine.com>2016-10-18 15:32:01 +0300
committerandreykproductengine <akleshchev@productengine.com>2016-10-18 15:32:01 +0300
commit6b1f96187d7a93a4bbaecf1a84162a141eed5971 (patch)
treebe7d682276238eee24b005462c9a0577ba554cd2
parent9564600206c0120f2249a48ba54920902c1a11eb (diff)
MAINT-6793 Rigged mesh sometimes full of holes
-rw-r--r--indra/newview/app_settings/settings.xml6
-rw-r--r--indra/newview/llappviewer.cpp2
-rw-r--r--indra/newview/llviewercontrol.cpp4
-rw-r--r--indra/newview/llvovolume.cpp38
-rw-r--r--indra/newview/llvovolume.h2
5 files changed, 40 insertions, 12 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 28c632b498..017b2a5249 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10273,16 +10273,16 @@
<key>Value</key>
<real>1.0</real>
</map>
- <key>RenderRiggedFactorMultiplier</key>
+ <key>RenderRiggedLodCompensation</key>
<map>
<key>Comment</key>
- <string>Affects level of detail for worn rigged meshes</string>
+ <string>Affects visibility range of worn rigged meshes to compensate for missing LODs (limited by avatars own visibility)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
- <real>7.5</real>
+ <real>6.5</real>
</map>
<key>RenderWater</key>
<map>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index b0829a3da1..bf7e643d0b 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -592,7 +592,7 @@ static void settings_to_globals()
LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic");
LLImageGL::sCompressTextures = gSavedSettings.getBOOL("RenderCompressTextures");
LLVOVolume::sLODFactor = gSavedSettings.getF32("RenderVolumeLODFactor");
- LLVOVolume::sRiggedFactorMultiplier = gSavedSettings.getF32("RenderRiggedFactorMultiplier");
+ LLVOVolume::sRiggedLODCompensation = llmax(0.25f, gSavedSettings.getF32("RenderRiggedLodCompensation"));
LLVOVolume::sDistanceFactor = 1.f-LLVOVolume::sLODFactor * 0.1f;
LLVolumeImplFlexible::sUpdateFactor = gSavedSettings.getF32("RenderFlexTimeFactor");
LLVOTree::sTreeFactor = gSavedSettings.getF32("RenderTreeLODFactor");
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 5e74e9f019..bdd79b0da1 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -209,7 +209,7 @@ static bool handleVolumeLODChanged(const LLSD& newvalue)
static bool handleRiggedLODChanged(const LLSD& newvalue)
{
- LLVOVolume::sRiggedFactorMultiplier = (F32)newvalue.asReal();
+ LLVOVolume::sRiggedLODCompensation = llmax(0.25f, (F32)newvalue.asReal());
return true;
}
@@ -625,7 +625,7 @@ void settings_setup_listeners()
gSavedSettings.getControl("WindLightUseAtmosShaders")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderGammaFull")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("RenderVolumeLODFactor")->getSignal()->connect(boost::bind(&handleVolumeLODChanged, _2));
- gSavedSettings.getControl("RenderRiggedFactorMultiplier")->getSignal()->connect(boost::bind(&handleRiggedLODChanged, _2));
+ gSavedSettings.getControl("RenderRiggedLodCompensation")->getSignal()->connect(boost::bind(&handleRiggedLODChanged, _2));
gSavedSettings.getControl("RenderAvatarLODFactor")->getSignal()->connect(boost::bind(&handleAvatarLODChanged, _2));
gSavedSettings.getControl("RenderAvatarPhysicsLODFactor")->getSignal()->connect(boost::bind(&handleAvatarPhysicsLODChanged, _2));
gSavedSettings.getControl("RenderTerrainLODFactor")->getSignal()->connect(boost::bind(&handleTerrainLODChanged, _2));
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 55739915a3..8d86623665 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -80,13 +80,14 @@
const F32 FORCE_SIMPLE_RENDER_AREA = 512.f;
const F32 FORCE_CULL_AREA = 8.f;
+static const F32 MINIMUM_RIGGED_RADIUS = 0.05f;
U32 JOINT_COUNT_REQUIRED_FOR_FULLRIG = 20;
BOOL gAnimateTextures = TRUE;
//extern BOOL gHideSelectedObjects;
F32 LLVOVolume::sLODFactor = 1.f;
-F32 LLVOVolume::sRiggedFactorMultiplier = 6.f;
+F32 LLVOVolume::sRiggedLODCompensation = 6.5f;
F32 LLVOVolume::sLODSlopDistanceFactor = 0.5f; //Changing this to zero, effectively disables the LOD transition slop
F32 LLVOVolume::sDistanceFactor = 1.0f;
S32 LLVOVolume::sNumLODChanges = 0;
@@ -1254,12 +1255,39 @@ BOOL LLVOVolume::calcLOD()
}
// Note: when changing, take note that a lot of rigged meshes have only one LOD.
- lod_factor *= LLVOVolume::sRiggedFactorMultiplier;
distance = avatar->mDrawable->mDistanceWRTCamera;
F32 avatar_radius = avatar->getBinRadius();
- F32 object_radius = getVolume() ? getVolume()->mLODScaleBias.scaledVec(getScale()).length() : getScale().length();
- radius = object_radius * LLVOVolume::sRiggedFactorMultiplier;
- radius = llmin(radius, avatar_radius);
+ F32 object_radius = 0;
+
+ LLDrawable* drawablep = mDrawable.get();
+ while (!drawablep->isRoot())
+ {
+ drawablep = drawablep->getParent();
+ }
+
+ // Mesh can consist of multiple objects that have to be treated as one item or we will
+ // get strange deformations or partially missing meshes (smallest elements will disappear)
+ LLSpatialBridge* bridge = drawablep->getSpatialBridge();
+ if (bridge)
+ {
+ const LLVector4a* ext = bridge->getSpatialExtents();
+ LLVector4a diff;
+ diff.setSub(ext[1], ext[0]);
+ object_radius = diff.getLength3().getF32();
+ }
+
+ if (object_radius <= 0)
+ {
+ // bridge missing or somehow not updated
+ const LLVector4a* ext = mDrawable->getSpatialExtents();
+ LLVector4a diff;
+ diff.setSub(ext[1], ext[0]);
+ object_radius = diff.getLength3().getF32();
+ }
+
+ // sRiggedLODCompensation is made to compensate for missing lower lods
+ radius = object_radius * LLVOVolume::sRiggedLODCompensation;
+ radius = llclamp(radius, MINIMUM_RIGGED_RADIUS, avatar_radius);
}
else
{
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index ca9917069b..ff005f8dc5 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -379,7 +379,7 @@ private:
public:
static F32 sLODSlopDistanceFactor;// Changing this to zero, effectively disables the LOD transition slop
static F32 sLODFactor; // LOD scale factor
- static F32 sRiggedFactorMultiplier; // Worn rigged LOD scale factor multiplier
+ static F32 sRiggedLODCompensation; // HACK: worn rigged LODs often have only high lod, so we are bumping them up withing avatar's visibility
static F32 sDistanceFactor; // LOD distance factor
static LLPointer<LLObjectMediaDataClient> sObjectMediaClient;