summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llheroprobemanager.cpp43
-rw-r--r--indra/newview/llheroprobemanager.h2
-rw-r--r--indra/newview/llviewerdisplay.cpp2
-rw-r--r--indra/newview/pipeline.cpp13
-rw-r--r--indra/newview/pipeline.h1
6 files changed, 61 insertions, 11 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index e7d947b85f..6a84f64030 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10390,6 +10390,17 @@
<key>Value</key>
<real>8</real>
</map>
+ <key>RenderHeroProbeUpdateRate</key>
+ <map>
+ <key>Comment</key>
+ <string>How many frames to wait for until it's time to render the probe. E.g., every other frame (1), every two frames (2), every three frames (3) etc.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <real>1</real>
+ </map>
<key>RenderReflectionProbeVolumes</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 2a81919856..0d9efb860a 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -155,6 +155,25 @@ void LLHeroProbeManager::update()
probe_pos.load3(point.mV);
+
+ // Collect the list of faces that need updating based upon the camera's rotation.
+ LLVector3 cam_direction = LLVector3(-1, -1, -1) * LLViewerCamera::instance().getQuaternion();
+
+ static LLVector3 cubeFaces[6] = {
+ LLVector3(1, 0, 0),
+ LLVector3(-1, 0, 0),
+ LLVector3(0, 1, 0),
+ LLVector3(0, -1, 0),
+ LLVector3(0, 0, 1),
+ LLVector3(0, 0, -1)
+ };
+
+ for (int i = 0; i < 6; i++)
+ {
+ bool shouldUpdate = (cam_direction * cubeFaces[i]) > 0;
+
+ mFaceUpdateList[i] = shouldUpdate;
+ }
}
else
{
@@ -185,8 +204,10 @@ void LLHeroProbeManager::update()
{
for (U32 i = 0; i < 6; ++i)
{
- updateProbeFace(mProbes[j], i, near_clip);
+ if (mFaceUpdateList[i])
+ updateProbeFace(mProbes[j], i, near_clip);
}
+ generateRadiance(mProbes[j]);
}
mRenderingMirror = false;
@@ -242,7 +263,7 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
LLRenderTarget *screen_rt = &gPipeline.mHeroProbeRT.screen;
LLRenderTarget *depth_rt = &gPipeline.mHeroProbeRT.deferredScreen;
-
+
// perform a gaussian blur on the super sampled render before downsampling
{
gGaussianProgram.bind();
@@ -318,14 +339,22 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
gGL.getTexUnit(diffuseChannel)->unbind(LLTexUnit::TT_TEXTURE);
gReflectionMipProgram.unbind();
}
+}
- if (face == 5)
+void LLHeroProbeManager::generateRadiance(LLReflectionMap* probe)
+{
+ S32 sourceIdx = mReflectionProbeCount;
+
+ // Unlike the reflectionmap manager, all probes are considered "realtime" for hero probes.
+ sourceIdx += 1;
{
mMipChain[0].bindTarget();
static LLStaticHashedString sSourceIdx("sourceIdx");
{
- //generate radiance map (even if this is not the irradiance map, we need the mip chain for the irradiance map)
+
+
+ // generate radiance map (even if this is not the irradiance map, we need the mip chain for the irradiance map)
gHeroRadianceGenProgram.bind();
mVertexBuffer->setBuffer();
@@ -334,10 +363,10 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
gHeroRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
gHeroRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
gHeroRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, mHeroProbeStrength);
-
+
U32 res = mMipChain[0].getWidth();
- for (int i = 0; i < mMipChain.size(); ++i)
+ for (int i = 0; i < mMipChain.size() / 4; ++i)
{
LL_PROFILE_GPU_ZONE("probe radiance gen");
static LLStaticHashedString sMipLevel("mipLevel");
@@ -351,7 +380,7 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face, F32 n
gHeroRadianceGenProgram.uniform1f(sStrength, 1);
for (int cf = 0; cf < 6; ++cf)
- { // for each cube face
+ { // for each cube face
LLCoordFrame frame;
frame.lookAt(LLVector3(0, 0, 0), LLCubeMapArray::sClipToCubeLookVecs[cf], LLCubeMapArray::sClipToCubeUpVecs[cf]);
diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h
index 552c5dcaab..7cc7e3b144 100644
--- a/indra/newview/llheroprobemanager.h
+++ b/indra/newview/llheroprobemanager.h
@@ -104,6 +104,7 @@ private:
// update the specified face of the specified probe
void updateProbeFace(LLReflectionMap* probe, U32 face, F32 near_clip);
+ void generateRadiance(LLReflectionMap *probe);
// list of active reflection maps
std::vector<LLPointer<LLReflectionMap> > mProbes;
@@ -134,6 +135,7 @@ private:
bool mReset = false;
bool mRenderingMirror = false;
+ std::map<int, bool> mFaceUpdateList;
std::set<LLPointer<LLVOVolume>> mHeroVOList;
LLPointer<LLVOVolume> mNearestHero;
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index e6d9aed1a3..2a77146101 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -658,7 +658,7 @@ 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)
+ if (gPipeline.RenderMirrors && !gSnapshot && (gPipeline.RenderHeroProbeUpdateRate == 0 || (gFrameCount % gPipeline.RenderHeroProbeUpdateRate) == 0))
{
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("Update hero probes");
gPipeline.mHeroProbeManager.update();
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 6ceaca731b..e3e2da3b30 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -199,6 +199,7 @@ F32 LLPipeline::RenderScreenSpaceReflectionAdaptiveStepMultiplier;
S32 LLPipeline::RenderScreenSpaceReflectionGlossySamples;
S32 LLPipeline::RenderBufferVisualization;
bool LLPipeline::RenderMirrors;
+S32 LLPipeline::RenderHeroProbeUpdateRate;
LLTrace::EventStatHandle<S64> LLPipeline::sStatBatchSize("renderbatchsize");
const U32 LLPipeline::MAX_BAKE_WIDTH = 512;
@@ -559,6 +560,7 @@ void LLPipeline::init()
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionGlossySamples");
connectRefreshCachedSettingsSafe("RenderBufferVisualization");
connectRefreshCachedSettingsSafe("RenderMirrors");
+ connectRefreshCachedSettingsSafe("RenderHeroProbeUpdateRate");
gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
}
@@ -786,9 +788,12 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
U32 res = mReflectionMapManager.mProbeResolution * 4; //multiply by 4 because probes will be 16x super sampled
allocateScreenBuffer(res, res, samples);
- res = mHeroProbeManager.mProbeResolution; // We also scale the hero probe RT to the probe res since we don't super sample it.
- mRT = &mHeroProbeRT;
- allocateScreenBuffer(res, res, samples);
+ if (RenderMirrors)
+ {
+ res = mHeroProbeManager.mProbeResolution; // We also scale the hero probe RT to the probe res since we don't super sample it.
+ mRT = &mHeroProbeRT;
+ allocateScreenBuffer(res, res, samples);
+ }
mRT = &mMainRT;
gCubeSnapshot = FALSE;
@@ -1068,6 +1073,8 @@ void LLPipeline::refreshCachedSettings()
LLViewerShaderMgr::instance()->clearShaderCache();
LLViewerShaderMgr::instance()->setShaders();
}
+ RenderHeroProbeUpdateRate = gSavedSettings.getS32("RenderHeroProbeUpdateRate");
+
sReflectionProbesEnabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionsEnabled") && gSavedSettings.getBOOL("RenderReflectionsEnabled");
RenderSpotLight = nullptr;
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 259dc3f9d0..fe00c52e6d 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -1056,6 +1056,7 @@ public:
static S32 RenderScreenSpaceReflectionGlossySamples;
static S32 RenderBufferVisualization;
static bool RenderMirrors;
+ static S32 RenderHeroProbeUpdateRate;
};
void render_bbox(const LLVector3 &min, const LLVector3 &max);