summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2024-02-02 15:43:56 -0600
committerRunitaiLinden <davep@lindenlab.com>2024-02-02 15:43:56 -0600
commit5abc68ad438c1feb79f008aa8148dda77aae2af9 (patch)
tree1c3a8d9454cd416f8ae3fabbf6b4fd0d27750142 /indra/newview
parent6846600e3ef1eec7fade19f61d2d45614ae1a8b0 (diff)
#677 Move PBR mirror radiance mixing to reflectionProbeF so transparent PBR surfaces can be mirrors
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl13
-rw-r--r--indra/newview/llviewercamera.cpp6
-rw-r--r--indra/newview/llviewershadermgr.cpp7
4 files changed, 26 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index d9dc83bb10..fe2647452f 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -682,6 +682,12 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit)
return col[1]+col[0];
}
+
+#if defined(HERO_PROBES)
+uniform vec4 clipPlane;
+uniform samplerCubeArray heroProbes;
+#endif
+
void doProbeSample(inout vec3 ambenv, inout vec3 glossenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit)
{
@@ -713,6 +719,18 @@ void doProbeSample(inout vec3 ambenv, inout vec3 glossenv,
glossenv = mix(glossenv, ssr.rgb, ssr.a);
}
#endif
+
+#if defined(HERO_PROBES)
+ float clipDist = dot(pos.xyz, clipPlane.xyz) + clipPlane.w;
+ if (clipDist > 0.0 && clipDist < 0.1 && glossiness > 0.8)
+ {
+ vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
+ if (dot(refnormpersp.xyz, clipPlane.xyz) > 0.0)
+ {
+ glossenv = textureLod(heroProbes, vec4(env_mat * refnormpersp, 0), (1.0-glossiness)*10).xyz;
+ }
+ }
+#endif
}
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index be180b877f..a8cfc3537e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -189,19 +189,6 @@ void main()
float gloss = 1.0 - perceptualRoughness;
sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear);
-
- #ifdef HERO_PROBES
- float clipDist = dot(pos.xyz, clipPlane.xyz) + clipPlane.w;
- if (clipDist > 0.0 && clipDist < 0.1 && perceptualRoughness < 0.2)
- {
- vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
- if (dot(refnormpersp.xyz, clipPlane.xyz) > 0.0)
- {
- radiance = textureLod(heroProbes, vec4(env_mat * refnormpersp, 0), perceptualRoughness*11).xyz;
- }
- }
- #endif
-
adjustIrradiance(irradiance, ambocc);
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index 4134e35f87..9ba42e4f47 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -764,6 +764,12 @@ BOOL LLViewerCamera::cameraUnderWater() const
{
LLViewerRegion* regionp = LLWorld::instance().getRegionFromPosAgent(getOrigin());
+ if (gPipeline.mHeroProbeManager.isMirrorPass())
+ {
+ // TODO: figure out how to handle this case
+ return FALSE;
+ }
+
if (!regionp)
{
regionp = gAgent.getRegion();
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 0aa0e13270..e9562d64e4 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -359,6 +359,8 @@ void LLViewerShaderMgr::setShaders()
return;
}
+ LLShaderMgr::sMirrorsEnabled = LLPipeline::RenderMirrors;
+
if (!gGLManager.mHasRequirements)
{
// Viewer will show 'hardware requirements' warning later
@@ -1813,11 +1815,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSoftenProgram.addPermutation("HAS_SUN_SHADOW", "1");
}
- if (LLPipeline::RenderMirrors)
- {
- gDeferredSoftenProgram.addPermutation("HERO_PROBES", "1");
- }
-
if (gSavedSettings.getBOOL("RenderDeferredSSAO"))
{ //if using SSAO, take screen space light map into account as if shadows are enabled
gDeferredSoftenProgram.mShaderLevel = llmax(gDeferredSoftenProgram.mShaderLevel, 2);