summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl25
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl76
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl51
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl42
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightWaterNonIndexedF.glsl44
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl11
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl50
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl81
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl106
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl34
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl65
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl (renamed from indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl)58
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/waterF.glsl14
24 files changed, 293 insertions, 462 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
index 9e61b6b894..c95f791dbf 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl
@@ -34,6 +34,6 @@ void main()
{
// NOTE: when this shader is used, only alpha is being written to
float a = diffuseLookup(vary_texcoord0.xy).a*vertex_color.a;
- frag_color = vec4(0, 0, 0, a);
+ frag_color = max(vec4(0, 0, 0, a), vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index 5d58cc91cd..a6fab10791 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -35,21 +35,19 @@ in vec3 vary_position;
in vec4 vertex_color;
in vec2 vary_texcoord0;
-#ifdef WATER_FOG
-vec4 applyWaterFogView(vec3 pos, vec4 color);
-#endif
-
vec3 srgb_to_linear(vec3 cs);
vec3 linear_to_srgb(vec3 cl);
-vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
-void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
#ifdef HAS_ALPHA_MASK
uniform float minimum_alpha;
#endif
#ifdef IS_ALPHA
+uniform vec4 waterPlane;
void waterClip(vec3 pos);
+void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
+ out vec3 atten);
+vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
#endif
void main()
@@ -78,26 +76,21 @@ void main()
vec3 pos = vary_position;
+ color.a = final_alpha;
#ifndef IS_HUD
+ color.rgb = srgb_to_linear(color.rgb);
+#ifdef IS_ALPHA
+
vec3 sunlit;
vec3 amblit;
vec3 additive;
vec3 atten;
calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten);
-#endif
-#ifdef WATER_FOG
+ color.rgb = applySkyAndWaterFog(pos, additive, atten, color).rgb;
- vec4 fogged = applyWaterFogView(pos, vec4(color.rgb, final_alpha));
- color.rgb = fogged.rgb;
- color.a = fogged.a;
-#else
- color.a = final_alpha;
#endif
-#ifndef IS_HUD
- color.rgb = srgb_to_linear(color.rgb);
- color.rgb = atmosFragLighting(color.rgb, additive, atten);
#endif
frag_color = max(color, vec4(0));
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 64e6bc9da2..3443785e1a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -106,7 +106,7 @@ vec3 toneMap(vec3 color)
color *= exposure * exp_scale;
// mix ACES and Linear here as a compromise to avoid over-darkening legacy content
- color = mix(toneMapACES_Hill(color), color, 0.333);
+ color = mix(toneMapACES_Hill(color), color, 0.3);
#endif
return color;
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
index cfdb393b34..f796bb5f3f 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -30,12 +30,14 @@ uniform vec4 waterFogColor;
uniform float waterFogDensity;
uniform float waterFogKS;
-vec3 getPositionEye();
-
vec3 srgb_to_linear(vec3 col);
vec3 linear_to_srgb(vec3 col);
-vec4 applyWaterFogView(vec3 pos, vec4 color)
+vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
+
+// get a water fog color that will apply the appropriate haze to a color given
+// a blend function of (ONE, SOURCE_ALPHA)
+vec4 getWaterFogViewNoClip(vec3 pos)
{
vec3 view = normalize(pos);
//normalize view vector
@@ -67,38 +69,76 @@ vec4 applyWaterFogView(vec3 pos, vec4 color)
float L = min(t1/t2*t3, 1.0);
float D = pow(0.98, l*kd);
+
+ return vec4(srgb_to_linear(kc.rgb*L), D);
+}
+
+vec4 getWaterFogView(vec3 pos)
+{
+ if (dot(pos, waterPlane.xyz) + waterPlane.w > 0.0)
+ {
+ return vec4(0,0,0,1);
+ }
+
+ return getWaterFogViewNoClip(pos);
+}
+
+vec4 applyWaterFogView(vec3 pos, vec4 color)
+{
+ vec4 fogged = getWaterFogView(pos);
- color.rgb = color.rgb * D + kc.rgb * L;
+ color.rgb = color.rgb * fogged.a + fogged.rgb;
return color;
}
-vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color, vec3 sunlit)
+vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color)
{
- color.rgb = linear_to_srgb(color.rgb);
- color = applyWaterFogView(pos, color);
- color.rgb = srgb_to_linear(color.rgb);
+ vec4 fogged = getWaterFogViewNoClip(pos);
+ color.rgb *= fogged.a;
+ color.rgb += fogged.rgb;
return color;
}
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit)
+vec4 applyWaterFogViewLinear(vec3 pos, vec4 color)
{
if (dot(pos, waterPlane.xyz) + waterPlane.w > 0.0)
{
return color;
}
- return applyWaterFogViewLinearNoClip(pos, color, sunlit);
+ return applyWaterFogViewLinearNoClip(pos, color);
}
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color)
+// for post deferred shaders, apply sky and water fog in a way that is consistent with
+// the deferred rendering haze post effects
+vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color)
{
- return applyWaterFogViewLinear(pos, color, vec3(1));
-}
+ bool eye_above_water = dot(vec3(0), waterPlane.xyz) + waterPlane.w > 0.0;
+ bool obj_above_water = dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0;
-vec4 applyWaterFog(vec4 color)
-{
- //normalize view vector
- return applyWaterFogViewLinear(getPositionEye(), color);
-}
+ if (eye_above_water)
+ {
+ if (!obj_above_water)
+ {
+ color.rgb = applyWaterFogViewLinearNoClip(pos, color).rgb;
+ }
+ else
+ {
+ color.rgb = atmosFragLighting(color.rgb, additive, atten);
+ }
+ }
+ else
+ {
+ if (obj_above_water)
+ {
+ color.rgb = atmosFragLighting(color.rgb, additive, atten);
+ }
+ else
+ {
+ color.rgb = applyWaterFogViewLinearNoClip(pos, color).rgb;
+ }
+ }
+ return color;
+}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl
deleted file mode 100644
index 670b3ddaf1..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskF.glsl
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * @file class1\lighting\lightWaterAlphaMaskF.glsl
- *
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-out vec4 frag_color;
-
-uniform float minimum_alpha;
-
-vec3 atmosLighting(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-in vec4 vertex_color;
-in vec2 vary_texcoord0;
-
-void default_lighting_water()
-{
- vec4 color = diffuseLookup(vary_texcoord0.xy);
-
- if (color.a < minimum_alpha)
- {
- discard;
- }
-
- color.rgb *= vertex_color.rgb;
-
- color.rgb = atmosLighting(color.rgb);
-
- frag_color = max(applyWaterFog(color), vec4(0));
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
deleted file mode 100644
index 09b4a6e317..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * @file class1\lighting\lightWaterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-out vec4 frag_color;
-
-in vec4 vertex_color;
-in vec2 vary_texcoord0;
-
-vec3 atmosLighting(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-void default_lighting_water()
-{
- vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
-
- color.rgb = atmosLighting(color.rgb);
-
- frag_color = max(applyWaterFog(color), vec4(0));
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterNonIndexedF.glsl
deleted file mode 100644
index 4888fa547c..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterNonIndexedF.glsl
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @file class1\lighting\lightWaterNonIndexedF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-out vec4 frag_color;
-
-in vec4 vertex_color;
-in vec2 vary_texcoord0;
-
-uniform sampler2D diffuseMap;
-
-vec3 atmosLighting(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-void default_lighting_water()
-{
- vec4 color = texture(diffuseMap,vary_texcoord0.xy) * vertex_color;
-
- color.rgb = atmosLighting(color.rgb);
-
- frag_color = max(applyWaterFog(color), vec4(0));
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl
deleted file mode 100644
index 2e87ac5bbc..0000000000
--- a/indra/newview/app_settings/shaders/class1/objects/simpleWaterF.glsl
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * @file simpleWaterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-
-
-void default_lighting_water();
-
-void main()
-{
- default_lighting_water();
-}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
index 6ecbfaecb1..4f88aed765 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl
@@ -30,7 +30,6 @@ vec3 getSunlitColor();
vec3 getAmblitColor();
vec3 getAdditiveColor();
vec3 getAtmosAttenuation();
-vec3 getPositionEye();
uniform float scene_light_strength;
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
index cc3617ba61..7b59e07243 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl
@@ -42,7 +42,6 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
void calcAtmospherics(vec3 inPositionEye) {
vec3 P = inPositionEye;
- setPositionEye(P);
vec3 tmpsunlit = vec3(1);
vec3 tmpamblit = vec3(1);
vec3 tmpaddlit = vec3(1);
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
index 34669a6796..9d5f60b313 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl
@@ -44,5 +44,5 @@ vec3 getAdditiveColor()
vec3 getAtmosAttenuation()
{
- return vec3(vary_AtmosAttenuation);
+ return vary_AtmosAttenuation;
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
index 1b854d80b3..0617bc9908 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl
@@ -31,7 +31,6 @@ vec3 additive_color;
vec3 atmos_attenuation;
vec3 sunlit_color;
vec3 amblit_color;
-vec3 position_eye;
vec3 getSunlitColor()
{
@@ -51,16 +50,6 @@ vec3 getAtmosAttenuation()
return atmos_attenuation;
}
-vec3 getPositionEye()
-{
- return position_eye;
-}
-
-void setPositionEye(vec3 v)
-{
- position_eye = v;
-}
-
void setSunlitColor(vec3 v)
{
sunlit_color = v;
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl
deleted file mode 100644
index 7a6741fe0e..0000000000
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterF.glsl
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @file class2\wl\atmosphericVarsWaterF.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-in vec3 vary_PositionEye;
-in vec3 vary_AdditiveColor;
-in vec3 vary_AtmosAttenuation;
-
-vec3 getSunlitColor()
-{
- return vec3(0,0,0);
-}
-vec3 getAmblitColor()
-{
- return vec3(0,0,0);
-}
-vec3 getAdditiveColor()
-{
- return vary_AdditiveColor;
-}
-vec3 getAtmosAttenuation()
-{
- return vary_AtmosAttenuation;
-}
-vec3 getPositionEye()
-{
- return vary_PositionEye;
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl
deleted file mode 100644
index 23c3aed4d8..0000000000
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsWaterV.glsl
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * @file class2\wl\atmosphericVarsWaterV.glsl
- *
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2007, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-out vec3 vary_PositionEye;
-out vec3 vary_AdditiveColor;
-out vec3 vary_AtmosAttenuation;
-
-vec3 atmos_attenuation;
-vec3 sunlit_color;
-vec3 amblit_color;
-
-vec3 getSunlitColor()
-{
- return sunlit_color;
-}
-vec3 getAmblitColor()
-{
- return amblit_color;
-}
-
-vec3 getAdditiveColor()
-{
- return vary_AdditiveColor;
-}
-vec3 getAtmosAttenuation()
-{
- return atmos_attenuation;
-}
-
-vec3 getPositionEye()
-{
- return vary_PositionEye;
-}
-
-void setPositionEye(vec3 v)
-{
- vary_PositionEye = v;
-}
-
-void setSunlitColor(vec3 v)
-{
- sunlit_color = v;
-}
-
-void setAmblitColor(vec3 v)
-{
- amblit_color = v;
-}
-
-void setAdditiveColor(vec3 v)
-{
- vary_AdditiveColor = v;
-}
-
-void setAtmosAttenuation(vec3 v)
-{
- atmos_attenuation = v;
- vary_AtmosAttenuation = v;
-}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index b63f3b60f9..acd32a81b3 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -65,16 +65,11 @@ uniform vec3 light_diffuse[8];
void waterClip(vec3 pos);
-#ifdef WATER_FOG
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
-#endif
-
vec3 srgb_to_linear(vec3 c);
vec3 linear_to_srgb(vec3 c);
vec2 encode_normal (vec3 n);
-vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
-
+vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
#ifdef HAS_SUN_SHADOW
@@ -270,12 +265,6 @@ void main()
color.rgb *= diffuse_linear.rgb;
- color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
-
-#ifdef WATER_FOG
- color = applyWaterFogViewLinear(pos.xyz, color, sunlit_linear);
-#endif // WATER_FOG
-
vec4 light = vec4(0,0,0,0);
#define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w);
@@ -291,6 +280,8 @@ void main()
// sum local light contrib in linear colorspace
color.rgb += light.rgb;
+ color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, color).rgb;
+
#endif // #else // FOR_IMPOSTOR
#ifdef IS_HUD
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index 35d752be02..003dd05e6f 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -82,11 +82,7 @@ vec3 srgb_to_linear(vec3 c);
vec3 linear_to_srgb(vec3 c);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
-vec3 atmosFragLightingLinear(vec3 color, vec3 additive, vec3 atten);
-
-#ifdef WATER_FOG
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
-#endif
+vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
float calcLegacyDistanceAttenuation(float distance, float falloff);
@@ -228,13 +224,6 @@ void main()
color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten);
- color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
-
-#ifdef WATER_FOG
- vec4 temp = applyWaterFogViewLinear(pos, vec4(color, 0.0), sunlit_linear);
- color = temp.rgb;
-#endif
-
vec3 light = vec3(0);
// Punctual lights
@@ -250,7 +239,8 @@ void main()
color.rgb += light.rgb;
-
+ color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, vec4(color, 1.0)).rgb;
+
float a = basecolor.a*vertex_color.a;
frag_color = max(vec4(color.rgb,a), vec4(0));
@@ -305,6 +295,7 @@ void main()
float a = basecolor.a*vertex_color.a;
color += colorEmissive;
+
color = linear_to_srgb(color);
frag_color = max(vec4(color.rgb,a), vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
index 5483a4e29c..8430cca325 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
@@ -40,6 +40,8 @@ in vec3 vary_position;
uniform samplerCube environmentMap;
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
+vec4 applyWaterFogViewLinear(vec3 pos, vec4 color);
+
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
vec3 linear_to_srgb(vec3 c);
@@ -83,7 +85,6 @@ void main()
color.rgb = srgb_to_linear(color.rgb);
applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity);
- color.rgb = atmosFragLighting(color.rgb, additive, atten);
#endif
color.a = 1.0;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl
new file mode 100644
index 0000000000..0b154e82ad
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl
@@ -0,0 +1,106 @@
+/**
+ * @file class3/deferred/hazeF.glsl
+ *
+ * $LicenseInfo:firstyear=2023&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2023, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+out vec4 frag_color;
+
+uniform sampler2D normalMap;
+
+// Inputs
+uniform vec3 sun_dir;
+uniform vec3 moon_dir;
+uniform int sun_up_factor;
+in vec2 vary_fragcoord;
+
+vec3 getNorm(vec2 pos_screen);
+vec4 getPositionWithDepth(vec2 pos_screen, float depth);
+void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
+
+float getDepth(vec2 pos_screen);
+
+vec3 linear_to_srgb(vec3 c);
+vec3 srgb_to_linear(vec3 c);
+
+uniform vec4 waterPlane;
+
+uniform int cube_snapshot;
+
+uniform float sky_hdr_scale;
+
+void main()
+{
+ vec2 tc = vary_fragcoord.xy;
+ float depth = getDepth(tc.xy);
+ vec4 pos = getPositionWithDepth(tc, depth);
+ vec4 norm = texture(normalMap, tc);
+ norm.xyz = getNorm(tc);
+ vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
+
+ vec3 color = vec3(0);
+ float bloom = 0.0;
+
+ vec3 sunlit;
+ vec3 amblit;
+ vec3 additive;
+ vec3 atten;
+
+ calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
+
+ vec3 sunlit_linear = srgb_to_linear(sunlit);
+
+ // mask off atmospherics below water (when camera is under water)
+ bool do_atmospherics = false;
+
+ if (dot(vec3(0), waterPlane.xyz) + waterPlane.w > 0.0 ||
+ dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0)
+ {
+ do_atmospherics = true;
+ }
+
+ vec3 irradiance = vec3(0);
+ vec3 radiance = vec3(0);
+
+ if (depth >= 1.0)
+ {
+ //should only be true of sky, clouds, sun/moon, and stars
+ discard;
+ }
+
+ float alpha = 0.0;
+
+ if (do_atmospherics)
+ {
+ alpha = atten.r;
+ color = srgb_to_linear(additive*2.0);
+ color *= sky_hdr_scale;
+ }
+ else
+ {
+ color = vec3(0,0,0);
+ alpha = 1.0;
+ }
+
+ frag_color = max(vec4(color.rgb, alpha), vec4(0)); //output linear since local lights will be added to this shader's results
+
+}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index acff03ec4b..ec1e49eeb4 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -37,11 +37,7 @@
uniform float emissive_brightness; // fullbright flag, 1.0 == fullbright, 0.0 otherwise
uniform int sun_up_factor;
-#ifdef WATER_FOG
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
-#endif
-
-vec3 atmosFragLightingLinear(vec3 l, vec3 additive, vec3 atten);
+vec4 applySkyAndWaterFog(vec3 pos, vec3 additive, vec3 atten, vec4 color);
vec3 scaleSoftClipFragLinear(vec3 l);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
@@ -386,13 +382,6 @@ void main()
glare += cur_glare;
}
- color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
-
-#ifdef WATER_FOG
- vec4 temp = applyWaterFogViewLinear(pos, vec4(color, 0.0), sunlit_linear);
- color = temp.rgb;
-#endif
-
vec3 npos = normalize(-pos.xyz);
vec3 light = vec3(0, 0, 0);
@@ -408,6 +397,8 @@ void main()
color += light;
+ color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, vec4(color, 1.0)).rgb;
+
glare *= 1.0-emissive;
glare = min(glare, 1.0);
float al = max(diffcol.a, glare) * vertex_color.a;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 35e99c5bd2..5e8fe9301a 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -83,10 +83,6 @@ uniform vec4 waterPlane;
uniform int cube_snapshot;
-#ifdef WATER_FOG
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color);
-#endif
-
uniform float sky_hdr_scale;
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
@@ -167,18 +163,6 @@ void main()
vec3 sunlit_linear = srgb_to_linear(sunlit);
vec3 amblit_linear = amblit;
- bool do_atmospherics = false;
-
-#ifndef WATER_FOG
- // when above water, mask off atmospherics below water
- if (dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0)
- {
- do_atmospherics = true;
- }
-#else
- do_atmospherics = true;
-#endif
-
vec3 irradiance = vec3(0);
vec3 radiance = vec3(0);
@@ -203,11 +187,6 @@ 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);
-
- if (do_atmospherics)
- {
- color = atmosFragLightingLinear(color, additive, atten);
- }
}
else if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS))
{
@@ -273,21 +252,8 @@ void main()
{ // add environment map
applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity);
}
-
-
- if (do_atmospherics)
- {
- color = atmosFragLightingLinear(color, additive, atten);
- }
}
-
-
- #ifdef WATER_FOG
- vec4 fogged = applyWaterFogViewLinear(pos.xyz, vec4(color, bloom));
- color = fogged.rgb;
- #endif
-
frag_color.rgb = max(color.rgb, vec3(0)); //output linear since local lights will be added to this shader's results
frag_color.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl
new file mode 100644
index 0000000000..f6b8299f91
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl
@@ -0,0 +1,65 @@
+/**
+ * @file class3/deferred/waterHazeF.glsl
+ *
+ * $LicenseInfo:firstyear=2023&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2023, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+out vec4 frag_color;
+
+// Inputs
+in vec4 vary_fragcoord;
+
+uniform sampler2D normalMap;
+
+vec4 getPositionWithDepth(vec2 pos_screen, float depth);
+float getDepth(vec2 pos_screen);
+
+vec4 getWaterFogView(vec3 pos);
+
+uniform int above_water;
+
+void main()
+{
+ vec2 tc = vary_fragcoord.xy/vary_fragcoord.w*0.5+0.5;
+ float depth = getDepth(tc.xy);
+
+ if (above_water > 0)
+ {
+ // we want to depth test when the camera is above water, but some GPUs have a hard time
+ // with depth testing against render targets that are bound for sampling in the same shader
+ // so we do it manually here
+
+ float cur_depth = vary_fragcoord.z/vary_fragcoord.w*0.5+0.5;
+ if (cur_depth > depth)
+ {
+ discard;
+ }
+ }
+
+ vec4 pos = getPositionWithDepth(tc, depth);
+ vec4 norm = texture(normalMap, tc);
+
+ vec4 fogged = getWaterFogView(pos.xyz);
+
+ frag_color = max(fogged, vec4(0)); //output linear since local lights will be added to this shader's results
+
+}
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl
index 2e5ed57014..16381a5d51 100644
--- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterAlphaMaskNonIndexedF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl
@@ -1,55 +1,59 @@
-/**
- * @file class1\lighting\lightWaterAlphaMaskNonIndexedF.glsl
+/**
+ * @file class3/deferred/waterHazeV.glsl
*
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2023&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2011, Linden Research, Inc.
- *
+ * Copyright (C) 2023, Linden Research, Inc.
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
- *
+ *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
+ *
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
-out vec4 frag_color;
+in vec3 position;
-uniform float minimum_alpha;
+uniform vec2 screen_res;
-uniform sampler2D diffuseMap;
+out vec4 vary_fragcoord;
-vec3 atmosLighting(vec3 light);
-vec4 applyWaterFog(vec4 color);
+// forwards
+void setAtmosAttenuation(vec3 c);
+void setAdditiveColor(vec3 c);
-in vec4 vertex_color;
-in vec2 vary_texcoord0;
+uniform vec4 waterPlane;
-void default_lighting_water()
+uniform int above_water;
+
+uniform mat4 modelview_projection_matrix;
+
+void main()
{
- vec4 color = texture(diffuseMap,vary_texcoord0.xy);
+ //transform vertex
+ vec4 pos = vec4(position.xyz, 1.0);
- if (color.a < minimum_alpha)
- {
- discard;
- }
+ if (above_water > 0)
+ {
+ pos = modelview_projection_matrix*pos;
+ }
- color.rgb *= vertex_color.rgb;
+ gl_Position = pos;
- color.rgb = atmosLighting(color.rgb);
+ // appease OSX GLSL compiler/linker by touching all the varyings we said we would
+ setAtmosAttenuation(vec3(1));
+ setAdditiveColor(vec3(0));
- color = applyWaterFog(color);
-
- frag_color = max(color, vec4(0));
+ vary_fragcoord = pos;
}
-
diff --git a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl
index e99ad5b474..223e55eb69 100644
--- a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl
@@ -30,7 +30,6 @@ uniform sampler2D bumpMap;
#ifdef TRANSPARENT_WATER
uniform sampler2D screenTex;
-uniform sampler2D screenDepth;
#endif
uniform vec4 fogCol;
@@ -55,7 +54,7 @@ in vec4 littleWave;
in vec4 view;
in vec3 vary_position;
-vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color, vec3 sunlit);
+vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color);
void main()
{
@@ -77,5 +76,7 @@ void main()
vec4 fb = vec4(waterFogColorLinear, 0.0);
#endif
- frag_color = max(applyWaterFogViewLinearNoClip(vary_position, fb, vec3(1)), vec4(0));
+ fb = applyWaterFogViewLinearNoClip(vary_position, fb);
+
+ frag_color = max(fb, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
index ddade462be..b364e454e8 100644
--- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
@@ -32,9 +32,8 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
#endif
vec3 scaleSoftClipFragLinear(vec3 l);
-vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
-vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit);
+vec4 applyWaterFogViewLinear(vec3 pos, vec4 color);
// PBR interface
vec2 BRDF(float NoV, float roughness);
@@ -77,7 +76,7 @@ uniform sampler2D bumpMap2;
uniform float blend_factor;
#ifdef TRANSPARENT_WATER
uniform sampler2D screenTex;
-uniform sampler2D screenDepth;
+uniform sampler2D depthMap;
#endif
uniform sampler2D refTex;
@@ -211,7 +210,7 @@ void main()
#ifdef TRANSPARENT_WATER
vec4 fb = texture(screenTex, distort2);
- float depth = texture(screenDepth, distort2).r;
+ float depth = texture(depthMap, distort2).r;
vec3 refPos = getPositionWithNDC(vec3(distort2*2.0-vec2(1.0), depth*2.0-1.0));
if (refPos.z > pos.z-0.05)
@@ -219,13 +218,12 @@ void main()
//we sampled an above water sample, don't distort
distort2 = distort;
fb = texture(screenTex, distort2);
- depth = texture(screenDepth, distort2).r;
+ depth = texture(depthMap, distort2).r;
refPos = getPositionWithNDC(vec3(distort2 * 2.0 - vec2(1.0), depth * 2.0 - 1.0));
}
- fb = applyWaterFogViewLinear(refPos, fb, sunlit);
#else
- vec4 fb = applyWaterFogViewLinear(viewVec*2048.0, vec4(1.0), sunlit_linear);
+ vec4 fb = applyWaterFogViewLinear(viewVec*2048.0, vec4(1.0));
#endif
// fudge sample on other side of water to be a tad darker
@@ -282,8 +280,6 @@ void main()
color = ((1.0 - f) * color) + fb.rgb;
- color = atmosFragLightingLinear(color, additive, atten);
-
float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0.05);
frag_color = max(vec4(color, spec), vec4(0));