diff options
Diffstat (limited to 'indra')
36 files changed, 127 insertions, 118 deletions
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index 19203ab670..0543a26642 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -34,7 +34,7 @@ VARYING vec2 vary_texcoord0; uniform vec4 color; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); mat4 getSkinnedTransform(); void calcAtmospherics(vec3 inPositionEye); @@ -62,7 +62,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 col = calcLighting(pos.xyz, norm, color, vec4(0,0,0,0)); + vec4 col = calcLighting(pos.xyz, norm, color); vertex_color = col; } diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl index 82db15c3ae..fac1599c6b 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl @@ -36,7 +36,7 @@ ATTRIBUTE vec2 texcoord0; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); +vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor); void calcAtmospherics(vec3 inPositionEye); void main() @@ -52,7 +52,7 @@ void main() calcAtmospherics(pos.xyz); vec4 specular = vec4(1.0); - vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); + vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular); vertex_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index f49f274de0..d11b81d2d3 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -194,6 +194,8 @@ void main() float final_alpha = diff.a; #endif + vec3 gamma_diff = diff.rgb; + diff.rgb = srgb_to_linear(diff.rgb); vec3 sunlit; @@ -239,10 +241,12 @@ vec3 post_sunlight = color.rgb; vec3 post_diffuse = color.rgb; //color.rgb = mix(diff.rgb, color.rgb, final_alpha); - - color.rgb = atmosFragLighting(color.rgb, additive, atten) * 2.0; + + color.rgb = atmosFragLighting(color.rgb, additive, atten); color.rgb = scaleSoftClipFrag(color.rgb); + //color.rgb = srgb_to_linear(color.rgb); + vec4 light = vec4(0,0,0,0); #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diff.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 * 0.5); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl index e68b082d43..e4d96a0028 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl @@ -29,13 +29,12 @@ ATTRIBUTE vec3 position; ATTRIBUTE vec3 normal; ATTRIBUTE vec2 texcoord0; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); void calcAtmospherics(vec3 inPositionEye); float calcDirectionalLight(vec3 n, vec3 l); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); VARYING vec3 vary_position; @@ -128,7 +127,7 @@ void main() col.rgb = vec3(0,0,0); // Add windlight lights - col.rgb = atmosAmbient(vec3(0.)); + col.rgb = atmosAmbient(); vary_ambient = col.rgb*color.rgb; vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl index 7fec3e03e7..5e4f08b017 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl @@ -34,7 +34,7 @@ ATTRIBUTE vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); VARYING vec4 vertex_color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index 816bd0bf3e..bdf3546aa5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -35,7 +35,7 @@ ATTRIBUTE vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); #ifdef WATER_FOG diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index b3d9b1e9c5..f21b7644bb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -75,6 +75,7 @@ VARYING vec2 vary_fragcoord; VARYING vec3 vary_position; +uniform mat4 proj_mat; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -97,6 +98,17 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe vec3 col = vec3(0,0,0); + vec4 proj_tc = proj_mat * lp; + + if (proj_tc.z < 0 + || proj_tc.x < 0 + || proj_tc.z > 1 + || proj_tc.y < 0 + || proj_tc.y > 1) + { + return col; + } + if (d > 0.0) { //normalize light vector @@ -381,6 +393,8 @@ vec3 post_env = col.rgb; vec3 post_atmo = col.rgb; + //col.rgb = srgb_to_linear(col.rgb); + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w * 0.5); LIGHT_LOOP(1) @@ -393,7 +407,7 @@ vec3 post_atmo = col.rgb; vec3 light_linear = light.rgb; - col.rgb += light_linear; + col.rgb += light_linear; vec3 postlight_linear = col.rgb; @@ -406,7 +420,7 @@ vec3 postlight_linear = col.rgb; al = temp.a; #endif -//col.rgb = light_linear; +//col.rgb = post_atmo; col.rgb = linear_to_srgb(col.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 83006c8916..e0fe6cfae1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -74,6 +74,8 @@ float getAmbientClamp(); void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); vec3 scaleSoftClipFrag(vec3 l); +vec3 srgb_to_linear(vec3 c); +vec3 linear_to_srgb(vec3 c); vec4 getPositionWithDepth(vec2 pos_screen, float depth); @@ -96,7 +98,9 @@ void main() final_da = clamp(final_da, 0.0, 1.0); //final_da = pow(final_da, light_gamma); - vec4 diffuse = texture2DRect(diffuseRect, tc); + vec4 gamma_diff = texture2DRect(diffuseRect, tc); + vec4 diffuse = gamma_diff; + diffuse.rgb = srgb_to_linear(gamma_diff.rgb); vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec3 col; @@ -126,7 +130,7 @@ vec3 post_ambient = col.rgb; vec3 post_sunlight = col.rgb; - col.rgb *= diffuse.rgb; + col.rgb *= gamma_diff.rgb; vec3 post_diffuse = col.rgb; @@ -177,8 +181,6 @@ vec3 post_diffuse = col.rgb; col = fogged.rgb; bloom = fogged.a; #endif - -//col.rgb = vec3(final_da); } frag_color.rgb = col.rgb; diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl index 5dcdbfaa50..ef27848d37 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -35,6 +35,7 @@ ATTRIBUTE vec3 position; ATTRIBUTE vec3 normal; ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec2 texcoord1; +ATTRIBUTE vec4 diffuse_color; VARYING vec4 vertex_color; VARYING vec4 vary_texcoord0; @@ -42,7 +43,7 @@ VARYING vec4 vary_texcoord1; void calcAtmospherics(vec3 inPositionEye); -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) { @@ -71,7 +72,7 @@ void main() /// Potentially better without it for water. pos /= pos.w; - vec4 color = calcLighting(pos.xyz, norm, vec4(1), vec4(0)); + vec4 color = calcLighting(pos.xyz, norm, /*diffuse_color*/vec4(1)); vertex_color = color; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl index 0b36229d4d..06aed40e26 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightSpecularV.glsl @@ -27,10 +27,10 @@ // All lights, no specular highlights -vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); +vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor); -vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol) +vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor) { - return sumLightsSpecular(pos, norm, color, specularColor, baseCol); + return sumLightsSpecular(pos, norm, color, specularColor); } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl index 9757070a82..2d41776ee2 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightV.glsl @@ -26,11 +26,13 @@ // All lights, no specular highlights +vec3 atmosAmbient(); +vec4 sumLights(vec3 pos, vec3 norm, vec4 color); -vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight); - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color) { - return sumLights(pos, norm, color, baseLight); + vec4 c = sumLights(pos, norm, color); + c.rgb += atmosAmbient() * color.rgb; + return c; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl index 9863f92e63..7c3697c333 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsSpecularV.glsl @@ -26,7 +26,7 @@ float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 atmosGetDiffuseSunlightColor(); vec3 scaleDownLight(vec3 light); @@ -34,7 +34,7 @@ vec3 scaleDownLight(vec3 light); uniform vec4 light_position[8]; uniform vec3 light_diffuse[8]; -vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol) +vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor) { vec4 col = vec4(0,0,0, color.a); @@ -45,8 +45,8 @@ vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0); col.rgb = scaleDownLight(col.rgb); - col.rgb += atmosAmbient(baseCol.rgb); - col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor()*baseCol.a, 1.0)); + col.rgb += atmosAmbient(); + col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz, atmosGetDiffuseSunlightColor(), 1.0)); col.rgb = min(col.rgb * color.rgb, 1.0); specularColor.rgb = min(specularColor.rgb * specularSum.rgb, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl index 9cc74cc219..761ac29ee2 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl @@ -28,20 +28,18 @@ uniform vec3 light_diffuse[8]; float calcDirectionalLight(vec3 n, vec3 l); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); -vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) +vec4 sumLights(vec3 pos, vec3 norm, vec4 color) { vec4 col = vec4(0); col.a = color.a; col.rgb = light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); col.rgb = scaleDownLight(col.rgb); - col.rgb += atmosAmbient(baseLight.rgb); col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz)); - col.rgb = min(col.rgb*color.rgb, 1.0); return col; } diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl index 591d6fc5c9..727bae19c0 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl @@ -36,7 +36,7 @@ VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -59,7 +59,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color); vertex_color = color; gl_Position = projection_matrix*vec4(pos, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl index fdb3453cc5..4ba8194d03 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -39,7 +39,7 @@ VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); void calcAtmospherics(vec3 inPositionEye); @@ -61,5 +61,5 @@ void main() calcAtmospherics(pos.xyz); - vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); + vertex_color = calcLighting(pos.xyz, norm, diffuse_color); } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl index 0be52a52af..22821a2f76 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl @@ -38,7 +38,7 @@ VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); void calcAtmospherics(vec3 inPositionEye); void main() @@ -52,7 +52,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 col = calcLighting(pos.xyz, norm, color, vec4(0.)); + vec4 col = calcLighting(pos.xyz, norm, color); vertex_color = col; diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl index cb80697d15..e605676819 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleNonIndexedV.glsl @@ -37,7 +37,7 @@ VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); void calcAtmospherics(vec3 inPositionEye); void main() @@ -54,7 +54,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm, diffuse_color); vertex_color = color; diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl index 1c6e53b187..df31b5a79f 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl @@ -35,7 +35,7 @@ VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -56,7 +56,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color); vertex_color = color; gl_Position = projection_matrix*vec4(pos, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl index d4dee78793..945f80f31e 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleTexGenV.glsl @@ -37,7 +37,7 @@ uniform vec4 color; uniform vec4 object_plane_t; uniform vec4 object_plane_s; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); void calcAtmospherics(vec3 inPositionEye); VARYING vec4 vertex_color; @@ -70,7 +70,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm, color); vertex_color = color; diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index 37a20383e2..a59bd9c0a6 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -34,7 +34,7 @@ ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; ATTRIBUTE vec4 diffuse_color; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); void calcAtmospherics(vec3 inPositionEye); @@ -57,7 +57,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm, diffuse_color); vertex_color = color; diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl index fa01a27ec0..179d3c42a4 100644 --- a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl @@ -31,8 +31,9 @@ uniform mat4 modelview_projection_matrix; ATTRIBUTE vec3 position; ATTRIBUTE vec2 texcoord0; ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); void calcAtmospherics(vec3 inPositionEye); VARYING vec4 vertex_color; @@ -53,7 +54,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm, diffuse_color); vertex_color = color; diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl index 06f13b11f2..206a51db27 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl @@ -27,10 +27,10 @@ uniform vec4 sunlight_color; uniform vec4 light_ambient; uniform int no_atmo; -vec3 atmosAmbient(vec3 light) +vec3 atmosAmbient() { - if (no_atmo == 1) return light + vec3(0.66); - return light + light_ambient.rgb; + if (no_atmo == 1) return vec3(0.16); + return light_ambient.rgb; } vec3 atmosAffectDirectionalLight(float lightIntensity) diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl index c24df9eaeb..c266f9732f 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl @@ -27,10 +27,10 @@ uniform vec4 sunlight_color; uniform vec4 light_ambient; uniform int no_atmo; -vec3 atmosAmbient(vec3 light) +vec3 atmosAmbient() { - if (no_atmo == 1) return light + vec3(0.66); - return light + light_ambient.rgb; + if (no_atmo == 1) return vec3(0.66); + return light_ambient.rgb; } vec3 atmosAffectDirectionalLight(float lightIntensity) diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl index 5af9f5c902..563c5f562b 100644 --- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl @@ -37,7 +37,7 @@ VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); +vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor); void calcAtmospherics(vec3 inPositionEye); void main() @@ -53,7 +53,7 @@ void main() // vec4 specular = specularColor; vec4 specular = vec4(1.0); - vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); + vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular); vertex_color = color; diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 7ccc91f73c..a82d738ec2 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -71,15 +71,8 @@ uniform vec2 screen_res; uniform mat4 inv_proj; -vec3 srgb_to_linear(vec3 cs); - vec3 getNorm(vec2 pos_screen); - -vec4 correctWithGamma(vec4 col) -{ - return vec4(srgb_to_linear(col.rgb), col.a); -} - +vec3 scaleDownLight(vec3 light); vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { vec4 ret = texture2DLod(projectionMap, tc, lod); @@ -220,14 +213,14 @@ void main() col = dlit*lit*diff_tex*shadow; // unshadowed for consistency between forward and deferred? - amb_da += (da*0.5+0.5)/* *(1.0-shadow) */ *proj_ambiance; + amb_da += (da*0.5+0.5) * (1.0-shadow) * proj_ambiance; } //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); - // unshadowed for consistency between forward and deferred? - amb_da += (da*da*0.5+0.5) /* *(1.0-shadow) */ * proj_ambiance; + // use unshadowed for consistency between forward and deferred? + amb_da += (da*da*0.5+0.5) * (1.0-shadow) * proj_ambiance; amb_da *= dist_atten * noise; amb_da = min(amb_da, 1.0-lit); @@ -259,10 +252,6 @@ void main() col += speccol; } } - - - - if (envIntensity > 0.0) { @@ -296,6 +285,8 @@ void main() //not sure why, but this line prevents MATBUG-194 col = max(col, vec3(0.0)); + col = scaleDownLight(col); + frag_color.rgb = col; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 2d5d1c1b50..06a76668ba 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -73,6 +73,8 @@ vec3 scaleSoftClipFrag(vec3 l); void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); float getAmbientClamp(); vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten); +vec3 linear_to_srgb(vec3 c); +vec3 srgb_to_linear(vec3 c); vec4 getPositionWithDepth(vec2 pos_screen, float depth); vec4 getPosition(vec2 pos_screen); @@ -99,14 +101,14 @@ void main() float da = dot(normalize(norm.xyz), light_dir.xyz); da = clamp(da, -1.0, 1.0); - vec4 diffuse = texture2DRect(diffuseRect, tc); - + vec4 gamma_diff = texture2DRect(diffuseRect, tc); + vec4 diffuse = gamma_diff; + diffuse.rgb = srgb_to_linear(diffuse.rgb); + scol = max(scol_ambocc.r, diffuse.a); - //scol = pow(scol, light_gamma); float final_da = da; final_da = clamp(final_da, 0.0, 1.0); - //final_da = pow(final_da, light_gamma); vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); vec3 col; @@ -138,7 +140,7 @@ vec3 post_ambient = col.rgb; vec3 post_sunlight = col.rgb; - col.rgb *= diffuse.rgb; + col.rgb *= gamma_diff.rgb; vec3 post_diffuse = col.rgb; @@ -169,7 +171,7 @@ vec3 post_diffuse = col.rgb; } } - col.rgb += diffuse.a * diffuse.rgb; + col.rgb += diffuse.a * gamma_diff.rgb; if (envIntensity > 0.0) { //add environmentmap diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 2844cc8574..cd3b33eecc 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -71,13 +71,8 @@ uniform vec2 screen_res; uniform mat4 inv_proj; -vec3 srgb_to_linear(vec3 cs); vec3 getNorm(vec2 pos_screen); - -vec4 correctWithGamma(vec4 col) -{ - return vec4(srgb_to_linear(col.rgb), col.a); -} +vec3 scaleDownLight(vec3 c); vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) { @@ -218,7 +213,7 @@ void main() col = dlit*lit*diff_tex*shadow; - amb_da += (da*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance; + amb_da += (da*0.5+0.5) * (1.0-shadow) * proj_ambiance; } //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); @@ -293,6 +288,8 @@ void main() //not sure why, but this line prevents MATBUG-194 col = max(col, vec3(0.0)); + col = scaleDownLight(col); + frag_color.rgb = col; frag_color.a = 0.0; } diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl index 6fcc41cd6d..89d9d1bde3 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsSpecularV.glsl @@ -28,7 +28,7 @@ float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da); vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 atmosGetDiffuseSunlightColor(); vec3 scaleDownLight(vec3 light); @@ -37,7 +37,7 @@ uniform vec4 light_position[8]; uniform vec4 light_attenuation[8]; uniform vec3 light_diffuse[8]; -vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol) +vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor) { vec4 col = vec4(0.0, 0.0, 0.0, color.a); @@ -53,8 +53,8 @@ vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor col.rgb = scaleDownLight(col.rgb); // Add windlight lights - col.rgb += atmosAmbient(baseCol.rgb); - col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor()*baseCol.a, 1.0)); + col.rgb += atmosAmbient(); + col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz, atmosGetDiffuseSunlightColor(), 1.0)); col.rgb = min(col.rgb*color.rgb, 1.0); specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0); diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl index b4f4850646..57f93a8b36 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl @@ -26,7 +26,6 @@ float calcDirectionalLight(vec3 n, vec3 l); float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); -vec3 atmosAmbient(vec3 light); vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); @@ -35,7 +34,7 @@ uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; -vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) +vec4 sumLights(vec3 pos, vec3 norm, vec4 color) { vec4 col = vec4(0.0, 0.0, 0.0, color.a); @@ -46,11 +45,8 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) col.rgb = scaleDownLight(col.rgb); // Add windlight lights - col.rgb += atmosAmbient(baseLight.rgb); col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz)); - col.rgb = min(col.rgb*color.rgb, 1.0); - return col; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl index c80706d2a7..9f049cb8fb 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl @@ -35,10 +35,10 @@ vec3 getPositionEye(); uniform float scene_light_strength; uniform int no_atmo; -vec3 atmosAmbient(vec3 light) +vec3 atmosAmbient() { - if (no_atmo == 1) return light + vec3(0.66); - return getAmblitColor() + light / 2.0; + if (no_atmo == 1) return vec3(0.66); + return getAmblitColor(); } vec3 atmosAffectDirectionalLight(float lightIntensity) diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index 9953f79cf2..ea37610502 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -32,14 +32,17 @@ vec3 getSunlitColor() { return vec3(0,0,0); } + vec3 getAmblitColor() { return vec3(0,0,0); } + vec3 getAdditiveColor() { return vary_AdditiveColor; } + vec3 getAtmosAttenuation() { return vec3(vary_AtmosAttenuation); diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index 2e8946252b..9cb9c723a2 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -39,8 +39,8 @@ vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) return light; } light *= atten.r; - light += additive * 2.0; - return light; + light += additive; + return light * 2.0; } vec3 atmosTransport(vec3 light) diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl index 721054b5ad..df9704ec25 100644 --- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl @@ -33,7 +33,7 @@ ATTRIBUTE vec4 clothing; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color); mat4 getSkinnedTransform(); void calcAtmospherics(vec3 inPositionEye); @@ -127,7 +127,7 @@ void main() calcAtmospherics(pos.xyz); - vec4 col = calcLighting(pos.xyz, norm, color, vec4(0.0)); + vec4 col = calcLighting(pos.xyz, norm, color); vertex_color = col; gl_Position = projection_matrix * pos; diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl index efe7f69f21..372992fab2 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl @@ -26,11 +26,13 @@ // All lights, no specular highlights +vec3 atmosAmbient(); +vec4 sumLights(vec3 pos, vec3 norm, vec4 color); -vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight); - -vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color) { - return sumLights(pos, norm, color, baseLight) * 2.0f; + vec4 c = sumLights(pos, norm, color * 2.0); + c.rgb += atmosAmbient() * color.rgb * 0.5; + return c; } diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl index 6d4192ab13..c1aee69c30 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl @@ -26,7 +26,7 @@ float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da); vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol); -vec3 atmosAmbient(vec3 light); +vec3 atmosAmbient(); vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 atmosGetDiffuseSunlightColor(); vec3 scaleDownLight(vec3 light); @@ -35,7 +35,7 @@ uniform vec4 light_position[8]; uniform vec4 light_attenuation[8]; uniform vec3 light_diffuse[8]; -vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol) +vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor) { vec4 col = vec4(0.0, 0.0, 0.0, color.a); @@ -55,8 +55,8 @@ vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor col.rgb = scaleDownLight(col.rgb); // Add windlight lights - col.rgb += atmosAmbient(baseCol.rgb); - col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor()*baseCol.a, 1.0)); + col.rgb += atmosAmbient(); + col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor(), 1.0)); col.rgb = min(col.rgb*color.rgb, 1.0); specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0); diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl index 097889039d..81da6688c2 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl @@ -1,5 +1,5 @@ /** - * @file class3\lighing\sumLightsV.glsl + * @file class3\lighting\sumLightsV.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code @@ -27,7 +27,6 @@ float calcDirectionalLight(vec3 n, vec3 l); float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); -vec3 atmosAmbient(vec3 light); vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); @@ -36,7 +35,7 @@ uniform vec3 light_direction[8]; uniform vec4 light_attenuation[8]; uniform vec3 light_diffuse[8]; -vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) +vec4 sumLights(vec3 pos, vec3 norm, vec4 color) { vec4 col = vec4(0.0, 0.0, 0.0, color.a); @@ -49,13 +48,11 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].z); col.rgb += light_diffuse[6].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[6], light_direction[6], light_attenuation[6].x, light_attenuation[6].z); col.rgb += light_diffuse[7].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[7], light_direction[7], light_attenuation[7].x, light_attenuation[7].z); - col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_direction[1].xyz); - col.rgb = scaleDownLight(col.grb); + col.rgb += light_diffuse[1].rgb*calcDirectionalLight(norm, light_position[1].xyz); + col.rgb = scaleDownLight(col.rgb); // Add windlight lights - col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_direction[0].xyz)); - col.rgb += atmosAmbient(baseLight.rgb); - + col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz)); col.rgb = min(col.rgb*color.rgb, 1.0); return col; |