summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2013-05-23 12:49:23 -0500
committerDave Parks <davep@lindenlab.com>2013-05-23 12:49:23 -0500
commite6de3d6232a12ace8f669abd4ede4c6f586046df (patch)
treebd82478ab3e39ad0caf655806960975c86bb141d /indra/newview/app_settings/shaders/class1
parent74a84738ed8779e345f34b95f029862b3c9ccf6e (diff)
parent6a9564eeadf54937a63d60e265cf304e6f81dc01 (diff)
Automated merge with https://bitbucket.org/lindenlab/viewer-development-materials
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl68
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl67
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl7
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/skyF.glsl2
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl27
6 files changed, 160 insertions, 13 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
index 975180606a..efb4d48845 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl
@@ -40,8 +40,6 @@ vec3 fullbrightScaleSoftClip(vec3 light);
void main()
{
- float shadow = 1.0;
-
vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color;
color.rgb = pow(color.rgb,vec3(2.2f,2.2f,2.2f));
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl
new file mode 100644
index 0000000000..b2bfd69f6e
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl
@@ -0,0 +1,68 @@
+/**
+ * @file fullbrightShinyF.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$
+ */
+
+
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+#ifndef diffuseLookup
+uniform sampler2D diffuseMap;
+#endif
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
+
+uniform samplerCube environmentMap;
+
+vec3 fullbrightShinyAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+void main()
+{
+#ifdef diffuseLookup
+ vec4 color = diffuseLookup(vary_texcoord0.xy);
+#else
+ vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);
+#endif
+ color.rgb *= vertex_color.rgb;
+
+ vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb;
+ color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a);
+
+ color.rgb = pow(color.rgb,vec3(2.2f,2.2f,2.2f));
+
+ color.rgb = fullbrightShinyAtmosTransport(color.rgb);
+ color.rgb = fullbrightScaleSoftClip(color.rgb);
+
+ color.a = 1.0;
+
+ frag_color = color;
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl
new file mode 100644
index 0000000000..34bd8d445a
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl
@@ -0,0 +1,67 @@
+/**
+ * @file fullbrightShinyV.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$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 texture_matrix1;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+
+void calcAtmospherics(vec3 inPositionEye);
+
+uniform vec4 origin;
+
+
+
+ATTRIBUTE vec3 position;
+void passTextureIndex();
+ATTRIBUTE vec3 normal;
+ATTRIBUTE vec4 diffuse_color;
+ATTRIBUTE vec2 texcoord0;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+VARYING vec3 vary_texcoord1;
+
+
+void main()
+{
+ //transform vertex
+ vec4 vert = vec4(position.xyz,1.0);
+ passTextureIndex();
+ vec4 pos = (modelview_matrix * vert);
+ gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+
+ vec3 norm = normalize(normal_matrix * normal);
+ vec3 ref = reflect(pos.xyz, -norm);
+
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+ vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz;
+
+ calcAtmospherics(pos.xyz);
+
+ vertex_color = diffuse_color;
+}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index fc4b8b33f8..539efa3499 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -28,6 +28,9 @@
#define DIFFUSE_ALPHA_MODE_MASK 2
#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
+#if DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE
+uniform float emissive_brightness;
+#endif
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
@@ -37,7 +40,6 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-
#if HAS_SUN_SHADOW
uniform sampler2DShadow shadowMap0;
@@ -472,7 +474,7 @@ void main()
vec4 final_color = diffcol;
#if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE)
- final_color.a = 0;
+ final_color.a = emissive_brightness;
#endif
vec4 final_specular = spec;
@@ -646,6 +648,7 @@ void main()
frag_color.a = max(diffcol.a*vertex_color.a, glare);
#else
+
frag_data[0] = final_color;
#ifdef UGLY_MAC_HACK
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index 49ad064364..22f4729e2e 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -61,6 +61,6 @@ void main()
/// Gamma correct for WL (soft clip effect).
frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0);
frag_data[1] = vec4(0.0,0.0,0.0,0.0);
- frag_data[2] = vec4(0.5,0.5,0.0,0);
+ frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 9197df2628..b688c1a70c 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -231,9 +231,9 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
+ tmpAmbient)));
//brightness of surface both sunlight and ambient
- setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * 2.2);
- setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * 2.2);
- setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * 2.2);
+ setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * global_gamma);
+ setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * global_gamma);
+ setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * global_gamma);
}
vec3 atmosLighting(vec3 light)
@@ -308,7 +308,7 @@ void main()
col.rgb *= ambient;
- col += atmosAffectDirectionalLight(max(min(da, 1.0) * 2.6, diffuse.a));
+ col += atmosAffectDirectionalLight(max(min(da, 1.0) * 2.6, 0.0));
col *= diffuse.rgb;
@@ -328,17 +328,28 @@ void main()
col += spec_contrib;
}
+ col = mix(col.rgb, diffuse.rgb, diffuse.a);
+
if (envIntensity > 0.0)
{ //add environmentmap
vec3 env_vec = env_mat * refnormpersp;
- col = mix(col.rgb, pow(textureCube(environmentMap, env_vec).rgb, vec3(2.2)) * 2.2,
+
+ float exponent = mix(2.2, 1.0, diffuse.a);
+
+ col = mix(col.rgb, pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent)) * exponent,
envIntensity);
+
+ exponent = mix(1.0, 2.2, diffuse.a);
+ col.rgb = pow(col.rgb, vec3(exponent))/exponent;
}
- col = atmosLighting(col);
- col = scaleSoftClip(col);
+ if (norm.w < 0.5)
+ {
+ col = atmosLighting(col);
+ col = scaleSoftClip(col);
+ }
- col = mix(col.rgb, diffuse.rgb, diffuse.a);
+ //col.g = envIntensity;
}
frag_color.rgb = col;