summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/environment/waterF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/waterF.glsl38
1 files changed, 20 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
index 349f3b9a67..b9de4edc67 100644
--- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
@@ -135,8 +135,10 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear);
+/*
void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit);
+*/
vec3 getPositionWithNDC(vec3 ndc);
@@ -189,7 +191,7 @@ void main()
vB = cross(vN, vT);
vec3 pos = vary_position.xyz;
- float linear_depth = 1 / -pos.z;
+ float linear_depth = 1.0 / -pos.z;
float dist = length(pos.xyz);
@@ -220,10 +222,10 @@ void main()
calculateFresnelFactors(df3, df2, normalize(view.xyz), wave1, wave2, wave3, wavef);
- vec3 waver = wavef*3;
+ vec3 waver = wavef*3.0;
vec3 up = transform_normal(vec3(0,0,1));
- float vdu = -dot(viewVec, up)*2;
+ float vdu = -dot(viewVec, up)*2.0;
vec3 wave_ibl = wavef * normScale;
wave_ibl.z *= 2.0;
@@ -231,7 +233,7 @@ void main()
vec3 norm = transform_normal(normalize(wavef));
- vdu = clamp(vdu, 0, 1);
+ vdu = clamp(vdu, 0.0, 1.0);
//wavef.z *= max(vdu*vdu*vdu, 0.1);
wavef = normalize(wavef);
@@ -243,7 +245,7 @@ void main()
dist = max(dist, 5.0);
//figure out distortion vector (ripply)
- vec2 distort2 = distort + waver.xy * refScale / max(dmod, 1.0) * 2;
+ vec2 distort2 = distort + waver.xy * refScale / max(dmod, 1.0) * 2.0;
distort2 = clamp(distort2, vec2(0), vec2(0.999));
@@ -256,7 +258,7 @@ void main()
#endif
vec3 sunlit_linear = sunlit;
- float fade = 1;
+ float fade = 1.0;
#ifdef TRANSPARENT_WATER
float depth = texture(depthMap, distort).r;
@@ -264,12 +266,12 @@ void main()
// Calculate some distance fade in the water to better assist with refraction blending and reducing the refraction texture's "disconnect".
#ifdef SHORELINE_FADE
- fade = max(0,min(1, (pos.z - refPos.z) / 10));
+ fade = max(0.0,min(1.0, (pos.z - refPos.z) / 10.0));
#else
- fade = 1;
+ fade = 1.0;
#endif
fade *= water_mask;
- distort2 = mix(distort, distort2, min(1, fade * 10));
+ distort2 = mix(distort, distort2, min(1.0, fade * 10.0));
depth = texture(depthMap, distort2).r;
refPos = getPositionWithNDC(vec3(distort2 * 2.0 - vec2(1.0), depth * 2.0 - 1.0));
@@ -284,13 +286,13 @@ void main()
#else
vec4 fb = applyWaterFogViewLinear(viewVec*2048.0, vec4(1.0));
- if (water_mask < 1)
+ if (water_mask < 1.0)
discard;
#endif
float metallic = 1.0;
float perceptualRoughness = blurMultiplier;
- float gloss = 1 - perceptualRoughness;
+ float gloss = 1.0 - perceptualRoughness;
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
@@ -316,7 +318,7 @@ void main()
float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0);
- float nl = 0;
+ float nl = 0.0;
vec3 diffPunc = vec3(0);
vec3 specPunc = vec3(0);
@@ -326,23 +328,23 @@ void main()
radiance *= df2.y;
//radiance = toneMapNoExposure(radiance);
vec3 color = vec3(0);
- color = mix(fb.rgb, radiance, min(1, df2.x)) + punctual.rgb;
+ color = mix(fb.rgb, radiance, min(1.0, df2.x)) + punctual.rgb;
- float water_haze_scale = 4;
+ float water_haze_scale = 4.0;
if (classic_mode > 0)
- water_haze_scale = 1;
+ water_haze_scale = 1.0;
// This looks super janky, but we do this to restore water haze in the distance.
// These values were finagled in to try and bring back some of the distant brightening on legacy water. Also works reasonably well on PBR skies such as PBR midday.
// color = mix(color, additive * water_haze_scale, (1 - atten));
// We shorten the fade here at the shoreline so it doesn't appear too soft from a distance.
- fade *= 60;
- fade = min(1, fade);
+ fade *= 60.0;
+ fade = min(1.0, fade);
color = mix(fb.rgb, color, fade);
- float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0);
+ float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0.0);
frag_color = min(vec4(1),max(vec4(color.rgb, spec * water_mask), vec4(0)));
}