summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl35
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl66
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl74
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl13
6 files changed, 102 insertions, 102 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index da47d60049..59950a88ef 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -25,6 +25,10 @@
#extension GL_ARB_texture_rectangle : enable
+#define INDEXED 1
+#define NON_INDEXED 2
+#define NON_INDEXED_NO_COLOR 3
+
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
#else
@@ -35,9 +39,8 @@ uniform sampler2DShadow shadowMap0;
uniform sampler2DShadow shadowMap1;
uniform sampler2DShadow shadowMap2;
uniform sampler2DShadow shadowMap3;
-uniform sampler2DRect depthMap;
-#ifndef INDEX_MODE
+#if INDEX_MODE != INDEXED
uniform sampler2D diffuseMap;
#endif
@@ -53,12 +56,9 @@ VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_pointlight_col;
VARYING vec2 vary_texcoord0;
-VARYING vec2 vary_texcoord1;
-VARYING vec2 vary_texcoord2;
VARYING vec3 vary_norm;
-VARYING mat3 vary_rotation;
-#ifdef INDEX_MODE_USE_COLOR
+#if INDEX_MODE != NON_INDEXED_NO_COLOR
VARYING vec4 vertex_color;
#endif
@@ -66,19 +66,11 @@ uniform mat4 shadow_matrix[6];
uniform vec4 shadow_clip;
uniform float shadow_bias;
-uniform mat4 inv_proj;
-
uniform vec4 light_position[8];
uniform vec3 light_direction[8];
uniform vec3 light_attenuation[8];
uniform vec3 light_diffuse[8];
-uniform sampler2D bumpMap;
-uniform samplerCube environmentMap;
-uniform mat3 env_mat;
-
-uniform vec4 specular_color;
-
vec3 calcDirectionalLight(vec3 n, vec3 l)
{
float a = pow(max(dot(n,l),0.0), 0.7);
@@ -206,22 +198,19 @@ void main()
}
vec4 diff;
-#ifdef INDEX_MODE
+#if INDEX_MODE == INDEXED
diff = diffuseLookup(vary_texcoord0.xy);
#else
diff = texture2D(diffuseMap,vary_texcoord0.xy);
#endif
-
-#ifdef INDEX_MODE_USE_COLOR
- float vertex_color_alpha = vertex_color.a;
-#else
+ diff.rgb = pow(diff.rgb, vec3(2.2));
+#if INDEX_MODE == NON_INDEXED_NO_COLOR
float vertex_color_alpha = 1.0;
+#else
+ float vertex_color_alpha = vertex_color.a;
#endif
- vec3 normal = texture2D(bumpMap, vary_texcoord1.xy).xyz * 2 - 1;
- normal = vec3(dot(normal.xyz, vary_rotation[0]),
- dot(normal.xyz, vary_rotation[1]),
- dot(normal.xyz, vary_rotation[2]));
+ vec3 normal = vary_norm;
vec3 l = light_position[0].xyz;
vec3 dlight = calcDirectionalLight(normal, l);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
index 45f3946467..dc4dd5d5e9 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -23,6 +23,10 @@
* $/LicenseInfo$
*/
+#define INDEXED 1
+#define NON_INDEXED 2
+#define NON_INDEXED_NO_COLOR 3
+
uniform mat3 normal_matrix;
uniform mat4 texture_matrix0;
uniform mat4 projection_matrix;
@@ -30,24 +34,20 @@ uniform mat4 modelview_matrix;
uniform mat4 modelview_projection_matrix;
ATTRIBUTE vec3 position;
-#ifdef INDEX_MODE
+#if INDEX_MODE == INDEXED
void passTextureIndex();
#endif
ATTRIBUTE vec3 normal;
+#if INDEX_MODE != NON_INDEXED_NO_COLOR
ATTRIBUTE vec4 diffuse_color;
+#endif
ATTRIBUTE vec2 texcoord0;
-ATTRIBUTE vec3 binormal;
-ATTRIBUTE vec2 texcoord1;
-ATTRIBUTE vec2 texcoord2;
-
-#ifdef HAS_SKIN
+#if HAS_SKIN
mat4 getObjectSkinnedTransform();
-#else
-#ifdef IS_AVATAR_SKIN
+#elif IS_AVATAR_SKIN
mat4 getSkinnedTransform();
#endif
-#endif
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
void calcAtmospherics(vec3 inPositionEye);
@@ -65,16 +65,13 @@ VARYING vec3 vary_fragcoord;
VARYING vec3 vary_position;
VARYING vec3 vary_pointlight_col;
-#ifdef INDEX_MODE_USE_COLOR
+#if INDEX_MODE != NON_INDEXED_NO_COLOR
VARYING vec4 vertex_color;
#endif
VARYING vec2 vary_texcoord0;
-VARYING vec2 vary_texcoord1;
-VARYING vec2 vary_texcoord2;
VARYING vec3 vary_norm;
-VARYING mat3 vary_rotation;
uniform float near_clip;
uniform float shadow_offset;
@@ -127,7 +124,7 @@ void main()
vec3 norm;
//transform vertex
-#ifdef HAS_SKIN
+#if HAS_SKIN
mat4 trans = getObjectSkinnedTransform();
trans = modelview_matrix * trans;
@@ -137,8 +134,7 @@ void main()
norm = normalize((trans * vec4(norm, 1.0)).xyz - pos.xyz);
vec4 frag_pos = projection_matrix * pos;
gl_Position = frag_pos;
-#else
-#ifdef IS_AVATAR_SKIN
+#elif IS_AVATAR_SKIN
mat4 trans = getSkinnedTransform();
vec4 pos_in = vec4(position.xyz, 1.0);
pos.x = dot(trans[0], pos_in);
@@ -159,11 +155,8 @@ void main()
pos = (modelview_matrix * vert);
gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
#endif
-#endif
-
- vary_texcoord1 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
- vary_texcoord2 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
-#ifdef INDEX_MODE
+
+#if INDEX_MODE == INDEXED
passTextureIndex();
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
#else
@@ -174,44 +167,39 @@ void main()
float dp_directional_light = max(0.0, dot(norm, light_position[0].xyz));
vary_position = pos.xyz + light_position[0].xyz * (1.0-dp_directional_light)*shadow_offset;
- vec3 n = norm;
- vec3 b = normalize(normal_matrix * binormal);
- vec3 t = cross(b, n);
-
- vary_rotation[0] = vec3(t.x, b.x, n.x);
- vary_rotation[1] = vec3(t.y, b.y, n.y);
- vary_rotation[2] = vec3(t.z, b.z, n.z);
-
calcAtmospherics(pos.xyz);
+#if INDEX_MODE == NON_INDEXED_NO_COLOR
+ vec4 diffuse_color = vec4(1,1,1,1);
+#endif
+
//vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.));
vec4 col = vec4(0.0, 0.0, 0.0, diffuse_color.a);
- vary_pointlight_col = diffuse_color.rgb;
+ vec3 dff = pow(diffuse_color.rgb, vec3(2.2f,2.2f,2.2f));
+
+ vary_pointlight_col = dff;
col.rgb = vec3(0,0,0);
// Add windlight lights
col.rgb = atmosAmbient(col.rgb);
- vary_ambient = col.rgb*diffuse_color.rgb;
- vary_directional.rgb = atmosAffectDirectionalLight(1.0f);
+ vary_directional.rgb = atmosAffectDirectionalLight(1);
+ vary_ambient = col.rgb*dff;
- col.rgb = col.rgb*diffuse_color.rgb;
+ col.rgb = col.rgb*dff;
-#ifdef INDEX_MODE_USE_COLOR
+#if INDEX_MODE != NON_INDEXED_NO_COLOR
vertex_color = col;
#endif
-#ifdef HAS_SKIN
+#if HAS_SKIN
vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip);
-#else
-#ifdef IS_AVATAR_SKIN
+#elif IS_AVATAR_SKIN
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
#else
pos = modelview_projection_matrix * vert;
vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip);
#endif
-#endif
-
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 90b6856c5c..cfd50ec1ec 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -166,6 +166,9 @@ void main()
}
vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
+
+ float envIntensity = norm.z;
+
norm = decode_normal(norm.xy);
norm = normalize(norm);
@@ -193,7 +196,11 @@ void main()
vec3 col = vec3(0,0,0);
vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
-
+
+ vec4 spec = texture2DRect(specularRect, frag.xy);
+
+
+
float noise = texture2D(noiseMap, frag.xy/128.0).b;
if (proj_tc.z > 0.0 &&
proj_tc.x < 1.0 &&
@@ -201,11 +208,13 @@ void main()
proj_tc.x > 0.0 &&
proj_tc.y > 0.0)
{
- float lit = 0.0;
float amb_da = proj_ambiance;
-
+ float lit = 0.0;
+
if (da > 0.0)
{
+ lit = da * dist_atten * noise;
+
float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0);
float lod = diff * proj_lod;
@@ -213,8 +222,6 @@ void main()
vec3 lcol = color.rgb * plcol.rgb * plcol.a;
- lit = pow(da,0.7) * dist_atten * noise;
-
col = lcol*lit*diff_tex*shadow;
amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance;
}
@@ -231,10 +238,37 @@ void main()
col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
}
-
- vec4 spec = texture2DRect(specularRect, frag.xy);
+
if (spec.a > 0.0)
{
+ float lit = da * dist_atten * noise;
+ vec3 npos = -normalize(pos);
+
+ //vec3 ref = dot(pos+lv, norm);
+ vec3 h = normalize(lv+npos);
+ float nh = dot(norm, h);
+ float nv = dot(norm, npos);
+ float vh = dot(npos, h);
+ float sa = nh;
+ float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
+
+ float gtdenom = 2 * nh;
+ float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh));
+
+ if (nh > 0.0)
+ {
+ float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
+ col += lit*scol*color.rgb*spec.rgb*shadow;
+ //col += spec.rgb;
+ }
+ }
+
+
+
+
+
+ if (envIntensity > 0.0)
+ {
vec3 ref = reflect(normalize(pos), norm);
//project from point pos in direction ref to plane proj_p, proj_n
@@ -251,7 +285,7 @@ void main()
{
stc.xy /= stc.w;
- float fatten = clamp(spec.a*spec.a+spec.a*0.5, 0.25, 1.0);
+ float fatten = clamp(envIntensity*envIntensity+envIntensity*0.5, 0.25, 1.0);
//stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
@@ -261,29 +295,7 @@ void main()
stc.x > 0.0 &&
stc.y > 0.0)
{
-
- vec3 npos = -normalize(pos);
- lv = pfinal-pos.xyz;
- lv = normalize(lv);
-
- vec3 h = normalize(lv+npos);
- float nh = dot(norm, h);
- float nv = dot(norm, npos);
- float vh = dot(npos, h);
- float sa = nh;
- float fres = pow(1 - dot(h, npos), 5)*0.4+0.5;
-
- float gtdenom = 2 * nh;
- float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh)));
-
- if (nh > 0.0)
- {
- float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);
- col += scol*color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod).rgb*shadow*spec.rgb;
- }
-
- //vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod);
- //col += dist_atten*scol.rgb*color.rgb*scol.a*spec.rgb*shadow;
+ col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-envIntensity*proj_lod).rgb*shadow*spec.rgb;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 5fb22c7f4d..3d39394c32 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -60,6 +60,7 @@ uniform float density_multiplier;
uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
+uniform float global_gamma;
uniform float scene_light_strength;
uniform mat3 env_mat;
uniform vec4 shadow_clip;
@@ -233,9 +234,9 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {
+ tmpAmbient)));
//brightness of surface both sunlight and ambient
- setSunlitColor(vec3(sunlight * .5));
- setAmblitColor(vec3(tmpAmbient * .25));
- setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
+ setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * 3.3);
+ setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * 3.3);
+ setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * 3.3);
}
vec3 atmosLighting(vec3 light)
@@ -293,7 +294,6 @@ void main()
float envIntensity = norm.z;
norm.xyz = decode_normal(norm.xy);
float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
- da = pow(da, 0.7);
vec4 diffuse = texture2DRect(diffuseRect, tc);
@@ -334,7 +334,7 @@ void main()
if (envIntensity > 0.0)
{ //add environmentmap
vec3 env_vec = env_mat * refnormpersp;
- col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,
+ col = mix(col.rgb, pow(textureCube(environmentMap, env_vec).rgb, vec3(2.2)) * 2.2,
max(envIntensity-diffuse.a*2.0, 0.0));
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 5fd6f0afb7..87180fd3e4 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -83,6 +83,7 @@ vec3 decode_normal (vec2 enc)
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
vec2 dist = tc-vec2(0.5);
@@ -98,6 +99,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
@@ -115,6 +117,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret.rgb = pow(ret.rgb, vec3(2.2));
vec2 dist = tc-vec2(0.5);
@@ -182,6 +185,7 @@ void main()
float fa = falloff+1.0;
float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0);
+ dist_atten = pow(dist_atten, 2.2) * 2.2;
if (dist_atten <= 0.0)
{
discard;
@@ -214,7 +218,7 @@ void main()
vec3 lcol = color.rgb * plcol.rgb * plcol.a;
- lit = pow(da, 0.7) * dist_atten * noise;
+ lit = da * dist_atten * noise;
col = lcol*lit*diff_tex*shadow;
amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
index da3d922017..d543479b85 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
@@ -54,6 +54,7 @@ uniform float density_multiplier;
uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
+uniform float global_gamma;
void calcAtmospherics(vec3 inPositionEye) {
@@ -129,11 +130,17 @@ void calcAtmospherics(vec3 inPositionEye) {
vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
+ (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
+ tmpAmbient)));
+
+ float gammaScale = 1.0;
+ if (global_gamma > 1.0)
+ {
+ gammaScale = global_gamma / 2 + global_gamma;
+ }
//brightness of surface both sunlight and ambient
- setSunlitColor(vec3(sunlight * .5));
- setAmblitColor(vec3(tmpAmbient * .25));
- setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1));
+ setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * gammaScale);
+ setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * gammaScale);
+ setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * gammaScale);
// vary_SunlitColor = vec3(0);
// vary_AmblitColor = vec3(0);