summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2024-02-02 13:49:06 -0600
committerRunitaiLinden <davep@lindenlab.com>2024-02-02 13:49:06 -0600
commit6846600e3ef1eec7fade19f61d2d45614ae1a8b0 (patch)
tree8649711c50680a441beace454c09fb0cd38ec520 /indra/newview/app_settings/shaders
parentee5fe08603a1250fb5e2c1196a082897134ebb53 (diff)
#677 Fix terrain clipping and tweak hero probe mixing with radiance
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl34
2 files changed, 32 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
index 33a78fd26d..8e1e4b54d5 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl
@@ -25,6 +25,7 @@
uniform mat3 normal_matrix;
uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
uniform mat4 modelview_projection_matrix;
in vec3 position;
@@ -59,7 +60,7 @@ void main()
vec4 t_pos = modelview_projection_matrix * pre_pos;
gl_Position = t_pos;
- pos = t_pos.xyz;
+ pos = (modelview_matrix*pre_pos).xyz;
vary_normal = normalize(normal_matrix * normal);
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*/
}