diff options
| author | RunitaiLinden <davep@lindenlab.com> | 2024-02-02 13:49:06 -0600 | 
|---|---|---|
| committer | RunitaiLinden <davep@lindenlab.com> | 2024-02-02 13:49:06 -0600 | 
| commit | 6846600e3ef1eec7fade19f61d2d45614ae1a8b0 (patch) | |
| tree | 8649711c50680a441beace454c09fb0cd38ec520 /indra/newview/app_settings/shaders/class3/deferred | |
| parent | ee5fe08603a1250fb5e2c1196a082897134ebb53 (diff) | |
#677 Fix terrain clipping and tweak hero probe mixing with radiance
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred')
| -rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl | 34 | 
1 files changed, 30 insertions, 4 deletions
| diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index b49c3386db..be180b877f 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -60,6 +60,7 @@ uniform float ssao_irradiance_max;  #endif  // Inputs +uniform vec4 clipPlane;  uniform mat3 env_mat;  uniform mat3  ssao_effect_mat;  uniform vec3 sun_dir; @@ -189,6 +190,19 @@ void main()          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);          vec3 diffuseColor; @@ -198,11 +212,11 @@ void main()          vec3 v = -normalize(pos.xyz);          color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten); -        #ifdef HERO_PROBES +        /*#ifdef HERO_PROBES          vec3 refnormpersp = reflect(pos.xyz, norm.xyz);              color = textureLod(heroProbes, vec4(env_mat * refnormpersp, 0), (1.0 - gloss) * 11).xyz * specularColor; -        #endif +        #endif*/      }      else if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS))      { @@ -226,6 +240,18 @@ void main()          sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false, amblit_linear); +        #ifdef HERO_PROBES +        float clipDist = dot(pos.xyz, clipPlane.xyz) + clipPlane.w; +        if (clipDist > 0.0 && clipDist < 0.1 && spec.a > 0.8) +        { +            vec3 refnormpersp = reflect(pos.xyz, norm.xyz); +            if (dot(refnormpersp.xyz, clipPlane.xyz) > 0.0) +            { +                radiance = textureLod(heroProbes, vec4(env_mat * refnormpersp, 0), (1.0-spec.a)*11).xyz; +            } +        } +        #endif +          adjustIrradiance(irradiance, ambocc);          // apply lambertian IBL only (see pbrIbl) @@ -261,9 +287,9 @@ void main()              // add radiance map              applyGlossEnv(color, glossenv, spec, pos.xyz, norm.xyz); -            #ifdef HERO_PROBES +            /*#ifdef HERO_PROBES              color = textureLod(heroProbes, vec4(env_mat * refnormpersp, 0), (1.0 - spec.a) * 11).xyz * spec.rgb; -            #endif +            #endif*/          } | 
