summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl25
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl6
4 files changed, 37 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index 2ec859fdae..9405a125fd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -505,3 +505,28 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
return color;
}
+
+uniform vec4 waterPlane;
+uniform float waterSign;
+
+// discard if given position in eye space is on the wrong side of the waterPlane according to waterSign
+void waterClip(vec3 pos)
+{
+ // TODO: make this less branchy
+ if (waterSign > 0)
+ {
+ if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) < -0.1)
+ {
+ discard;
+ }
+ }
+ else
+ {
+ if ((dot(pos.xyz, waterPlane.xyz) + waterPlane.w) > -0.1)
+ {
+ discard;
+ }
+ }
+
+}
+
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index b4406aabc0..b3f15f81f1 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -69,6 +69,8 @@ uniform vec3 light_direction[8];
uniform vec4 light_attenuation[8];
uniform vec3 light_diffuse[8];
+void waterClip(vec3 pos);
+
#ifdef WATER_FOG
vec4 applyWaterFogView(vec3 pos, vec4 color);
#endif
@@ -181,6 +183,7 @@ void main()
frag *= screen_res;
vec4 pos = vec4(vary_position, 1.0);
+ waterClip(pos.xyz);
vec3 norm = vary_norm;
float shadow = 1.0f;
@@ -295,6 +298,7 @@ void main()
#endif // #else // FOR_IMPOSTOR
+ //color.rgb = waterPlane.xyz * 0.5 + 0.5;
frag_color = color;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index 9bbc4f87bf..922da0c441 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -84,6 +84,8 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
vec3 pos, vec3 norm, float glossiness);
+void waterClip(vec3 pos);
+
// PBR interface
vec3 pbrIbl(vec3 diffuseColor,
vec3 specularColor,
@@ -139,6 +141,7 @@ void main()
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
vec3 pos = vary_position;
+ waterClip(pos);
// IF .mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels;
// vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index 1150d40007..8016022d78 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -90,6 +90,7 @@ uniform vec4 light_attenuation[8];
uniform vec3 light_diffuse[8];
float getAmbientClamp();
+void waterClip(vec3 pos);
vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, float ambiance)
{
@@ -219,6 +220,10 @@ vec2 encode_normal(vec3 n);
void main()
{
+#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
+ waterClip(vary_position.xyz);
+#endif
+
vec2 pos_screen = vary_texcoord0.xy;
vec4 diffcol = texture2D(diffuseMap, vary_texcoord0.xy);
@@ -277,7 +282,6 @@ void main()
#endif
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
-
//forward rendering, output lit linear color
diffcol.rgb = srgb_to_linear(diffcol.rgb);
final_specular.rgb = srgb_to_linear(final_specular.rgb);