summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2023-08-29 05:08:47 -0700
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2023-08-29 05:08:47 -0700
commit348d427db6537746c5c8c9a0d1aa021f074afbb5 (patch)
treee2782a5638bd489d30dcd0bb1fd507e575cc1fe2 /indra/newview
parentc5bfe869154cd4708c9bca63f08cb4c958198638 (diff)
Add a probe strength uniform for hero probes.
On standard reflection probes this doesn't really do anything. DRTVWR-583
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl2
-rw-r--r--indra/newview/llheroprobemanager.cpp73
-rw-r--r--indra/newview/llheroprobemanager.h7
-rw-r--r--indra/newview/llreflectionmapmanager.cpp1
-rw-r--r--indra/newview/llvovolume.cpp2
5 files changed, 32 insertions, 53 deletions
diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
index 9ecdf0bf77..cb6f34713c 100644
--- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
@@ -38,6 +38,7 @@ in vec3 vary_dir;
uniform float mipLevel;
uniform int u_width;
uniform float max_probe_lod;
+uniform float probe_strength;
// =============================================================================================================
@@ -163,5 +164,6 @@ void main()
{
vec3 N = normalize(vary_dir);
frag_color = max(prefilterEnvMap(N), vec4(0));
+ frag_color.a *= probe_strength;
}
// =============================================================================================================
diff --git a/indra/newview/llheroprobemanager.cpp b/indra/newview/llheroprobemanager.cpp
index 6374b10823..c385c9a99f 100644
--- a/indra/newview/llheroprobemanager.cpp
+++ b/indra/newview/llheroprobemanager.cpp
@@ -104,68 +104,41 @@ void LLHeroProbeManager::update()
llassert(mProbes[0] == mDefaultProbe);
LLVector4a probe_pos;
-
- if (mHeroList.empty())
+ LLVector3 camera_pos = LLViewerCamera::instance().mOrigin;
{
- LLVector3 focus_point;
+ // Get the nearest hero.
+ float distance = F32_MAX;
- LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject();
- if (obj && obj->mDrawable && obj->isSelected())
- { // focus on selected media object
- S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace();
- if (obj && obj->mDrawable)
- {
- LLFace* face = obj->mDrawable->getFace(face_idx);
- if (face)
- {
- focus_point = face->getPositionAgent();
- }
- }
+ if (mNearestHero.notNull())
+ {
+ distance = mNearestHero->mDistanceWRTCamera;
}
- if (focus_point.isExactlyZero())
+ for (auto drawable : mHeroList)
{
- if (LLViewerJoystick::getInstance()->getOverrideCamera())
- { // focus on point under cursor
- focus_point.set(gDebugRaycastIntersection.getF32ptr());
- }
- else if (gAgentCamera.cameraMouselook())
- { // focus on point under mouselook crosshairs
- LLVector4a result;
- result.clear();
-
- gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, FALSE, TRUE, NULL, &result);
-
- focus_point.set(result.getF32ptr());
- }
- else
+ if (drawable.notNull() && drawable != mNearestHero)
{
- // focus on alt-zoom target
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
+ if (drawable->mDistanceWRTCamera < distance)
{
- focus_point = LLVector3(gAgentCamera.getFocusGlobal() - region->getOriginGlobal());
+ mIsInTransition = true;
+ mNearestHero = drawable;
}
}
}
-
- probe_pos.load3(((focus_point)).mV);
+ }
+
+ if (mIsInTransition && mHeroProbeStrength > 0.f)
+ {
+ mHeroProbeStrength -= 0.05f;
}
else
{
- // Get the nearest hero.
- float distance = F32_MAX;
+ if (mNearestHero.notNull())
+ probe_pos.set(mNearestHero->mXform.getPosition().mV[0], mNearestHero->mXform.getPosition().mV[1], camera_pos.mV[2]);
- for (auto drawable : mHeroList)
- {
- if (drawable.notNull())
- {
- if (drawable->mDistanceWRTCamera < distance)
- {
- probe_pos.load3(drawable->mXform.getPosition().mV);
- }
- }
- }
+
+ if (mHeroProbeStrength < 1.f)
+ mHeroProbeStrength += 0.05f;
}
static LLCachedControl<S32> sDetail(gSavedSettings, "RenderHeroReflectionProbeDetail", -1);
@@ -328,7 +301,8 @@ void LLHeroProbeManager::updateProbeFace(LLReflectionMap* probe, U32 face)
mTexture->bind(channel);
gRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
-
+ gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, mHeroProbeStrength);
+
U32 res = mMipChain[0].getWidth();
for (int i = 0; i < mMipChain.size(); ++i)
@@ -554,7 +528,6 @@ void LLHeroProbeManager::registerHeroDrawable(LLDrawable* drawablep)
if (mHeroList.find(drawablep) == mHeroList.end())
{
mHeroList.insert(drawablep);
- LL_INFOS() << "Added hero drawable." << LL_ENDL;
}
}
diff --git a/indra/newview/llheroprobemanager.h b/indra/newview/llheroprobemanager.h
index c6df963cfd..24246af3d3 100644
--- a/indra/newview/llheroprobemanager.h
+++ b/indra/newview/llheroprobemanager.h
@@ -117,15 +117,18 @@ private:
U32 mReflectionProbeCount;
// resolution of reflection probes
- U32 mProbeResolution = 128;
+ U32 mProbeResolution = 1024;
// maximum LoD of reflection probes (mip levels - 1)
F32 mMaxProbeLOD = 6.f;
+
+ F32 mHeroProbeStrength = 1.f;
+ bool mIsInTransition = false;
// if true, reset all probe render state on the next update (for teleports and sky changes)
bool mReset = false;
LLDrawable::ordered_drawable_set_t mHeroList;
- LLDrawable* mNearestHero;
+ LLPointer<LLDrawable> mNearestHero;
};
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index e855be8fbd..61143c61e8 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -714,6 +714,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
mTexture->bind(channel);
gRadianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
+ gRadianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_STRENGTH, 1.f);
U32 res = mMipChain[0].getWidth();
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 6db1ae07de..3c3d8d5123 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -1045,7 +1045,7 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline)
updateReflectionProbePtr();
}
- if (isMirror())
+ //if (isMirror())
{
gPipeline.mHeroProbeManager.registerHeroDrawable(mDrawable);
}