summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2024-02-05 16:01:47 -0600
committerRunitaiLinden <davep@lindenlab.com>2024-02-05 16:01:47 -0600
commit75b67c3750083e5ea150432d999866a0e383f927 (patch)
treeaf22e6c8f3036983adfe4d9786ef8440161a0eb0 /indra
parent0e91d18da3f203bcef681d3134b736978114c2bd (diff)
#677 Add hero probes to blinn-phong surfaces
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl39
1 files changed, 28 insertions, 11 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index fe2647452f..4f6e01764a 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -684,10 +684,33 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit)
#if defined(HERO_PROBES)
+
uniform vec4 clipPlane;
uniform samplerCubeArray heroProbes;
+
+void tapHeroProbe(inout vec3 glossenv, vec3 pos, vec3 norm, float glossiness)
+{
+ 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;
+ }
+ }
+}
+
+#else
+
+void tapHeroProbe(inout vec3 glossenv, vec3 pos, vec3 norm, float glossiness)
+{
+}
+
#endif
+
+
void doProbeSample(inout vec3 ambenv, inout vec3 glossenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit)
{
@@ -720,17 +743,7 @@ void doProbeSample(inout vec3 ambenv, inout vec3 glossenv,
}
#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
+ tapHeroProbe(glossenv, pos, norm, glossiness);
}
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
@@ -818,6 +831,7 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout
{
float lod = (1.0-glossiness)*reflection_lods;
glossenv = sampleProbes(pos, normalize(refnormpersp), lod);
+
}
if (envIntensity > 0.0)
@@ -845,6 +859,9 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout
}
#endif
+ tapHeroProbe(glossenv, pos, norm, glossiness);
+ tapHeroProbe(legacyenv, pos, norm, 1.0);
+
glossenv = clamp(glossenv, vec3(0), vec3(10));
}