Improvements to mirror probe update rates (#1570)

#1494 Fix for mirror updates getting "stuck" on some faces.
master
Jonathan "Geenz" Goodman 2024-05-28 14:19:18 -07:00 committed by GitHub
parent c5f0b6f639
commit 33bb511ab4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 25 deletions

View File

@ -112,7 +112,6 @@ void LLHeroProbeManager::update()
LLVector4a probe_pos;
LLVector3 camera_pos = LLViewerCamera::instance().mOrigin;
F32 near_clip = 0.1f;
bool probe_present = false;
LLQuaternion cameraOrientation = LLViewerCamera::instance().getQuaternion();
LLVector3 cameraDirection = LLVector3::z_axis * cameraOrientation;
@ -192,20 +191,15 @@ void LLHeroProbeManager::update()
// Iterate through each face of the cube
for (int i = 0; i < 6; i++)
{
float cube_facing = fmax(-1, fmin(1.0f, cameraDirection * cubeFaces[i])) * 0.6 + 0.4;
float cube_facing = fmax(-1, fmin(1.0f, cameraDirection * cubeFaces[i]));
float updateRate;
if (cube_facing < 0.1f)
{
updateRate = 0;
}
else
{
updateRate = ceilf(cube_facing * gPipeline.RenderHeroProbeConservativeUpdateMultiplier);
}
cube_facing = 1 - cube_facing;
mFaceUpdateList[i] = updateRate;
mFaceUpdateList[i] = ceilf(cube_facing * gPipeline.RenderHeroProbeConservativeUpdateMultiplier);
}
mProbes[0]->mOrigin = probe_pos;
}
else
{
@ -214,25 +208,23 @@ void LLHeroProbeManager::update()
mHeroProbeStrength = 1;
}
else
{
probe_pos.load3(camera_pos.mV);
}
}
void LLHeroProbeManager::renderProbes()
{
static LLCachedControl<S32> sDetail(gSavedSettings, "RenderHeroReflectionProbeDetail", -1);
static LLCachedControl<S32> sLevel(gSavedSettings, "RenderHeroReflectionProbeLevel", 3);
if (mNearestHero != nullptr)
F32 near_clip = 0.01f;
if (mNearestHero != nullptr && (gPipeline.RenderHeroProbeUpdateRate == 0 || (gFrameCount % gPipeline.RenderHeroProbeUpdateRate) == 0) &&
!gTeleportDisplay && !gDisconnected && !LLAppViewer::instance()->logoutRequestSent())
{
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("hpmu - realtime");
// Probe 0 is always our mirror probe.
mProbes[0]->mOrigin = probe_pos;
bool radiance_pass = gPipeline.mReflectionMapManager.isRadiancePass();
gPipeline.mReflectionMapManager.mRadiancePass = true;
mRenderingMirror = true;
mRenderingMirror = true;
doOcclusion();
@ -585,8 +577,6 @@ void LLHeroProbeManager::cleanup()
mDefaultProbe = nullptr;
mUpdatingProbe = nullptr;
/*
*/
}
void LLHeroProbeManager::doOcclusion()

View File

@ -68,6 +68,8 @@ public:
// maintain reflection probes
void update();
void renderProbes();
// debug display, called from llspatialpartition if reflection
// probe debug display is active
void renderDebug();
@ -152,5 +154,6 @@ private:
std::vector<LLPointer<LLVOVolume>> mHeroVOList;
LLPointer<LLVOVolume> mNearestHero;
};

View File

@ -658,10 +658,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
{
// Render mirrors and associated hero probes before we render the rest of the scene.
// This ensures the scene state in the hero probes are exactly the same as the rest of the scene before we render it.
if (gPipeline.RenderMirrors && !gSnapshot && (gPipeline.RenderHeroProbeUpdateRate == 0 || (gFrameCount % gPipeline.RenderHeroProbeUpdateRate) == 0))
if (gPipeline.RenderMirrors && !gSnapshot)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Update hero probes");
gPipeline.mHeroProbeManager.update();
gPipeline.mHeroProbeManager.renderProbes();
}
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 1");
@ -1072,7 +1073,7 @@ void display_cube_face()
LLSpatialGroup::sNoDelete = TRUE;
S32 occlusion = LLPipeline::sUseOcclusion;
LLPipeline::sUseOcclusion = 1; // occlusion data is from main camera point of view, don't read or write it during cube snapshots
LLPipeline::sUseOcclusion = 0; // occlusion data is from main camera point of view, don't read or write it during cube snapshots
//gDepthDirty = TRUE; //let "real" render pipe know it can't trust the depth buffer for occlusion data
static LLCullResult result;