From 75b67c3750083e5ea150432d999866a0e383f927 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 5 Feb 2024 16:01:47 -0600 Subject: #677 Add hero probes to blinn-phong surfaces --- .../shaders/class3/deferred/reflectionProbeF.glsl | 39 ++++++++++++++++------ 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'indra/newview/app_settings') 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)); } -- cgit v1.2.3