diff options
author | Dave Parks <davep@lindenlab.com> | 2013-05-17 13:56:04 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2013-05-17 13:56:04 -0500 |
commit | 0ed964fd20c4b55e41d933b41f47583224754025 (patch) | |
tree | 4f4679fe2e228ef93b7648df501d927822866f15 /indra/newview/app_settings | |
parent | 174eda3ed010280277cf2771e838e902a74d6561 (diff) | |
parent | 88a42cd453b19e66551a36d635981da5aaa04933 (diff) |
Automated merge with https://bitbucket.org/lindenlab/viewer-development-materials
Diffstat (limited to 'indra/newview/app_settings')
6 files changed, 61 insertions, 11 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 84e83d4c8b..50b43f6a8d 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -60,10 +60,14 @@ VARYING vec3 vary_ambient; VARYING vec3 vary_directional; VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; -VARYING vec4 vary_pointlight_col; +VARYING vec3 vary_pointlight_col; VARYING vec2 vary_texcoord0; VARYING vec3 vary_norm; +#ifdef USE_VERTEX_COLOR +VARYING vec4 vertex_color; +#endif + uniform vec4 light_position[8]; uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; @@ -212,7 +216,7 @@ void main() diff.rgb = pow(diff.rgb, vec3(2.2f, 2.2f, 2.2f)); #ifdef USE_VERTEX_COLOR - float vertex_color_alpha = vary_pointlight_col.a; + float vertex_color_alpha = vertex_color.a; #else float vertex_color_alpha = 1.0; #endif @@ -221,7 +225,7 @@ void main() vec3 l = light_position[0].xyz; vec3 dlight = calcDirectionalLight(normal, l) * 2.6; - dlight = dlight * vary_directional.rgb * vary_pointlight_col.rgb; + dlight = dlight * vary_directional.rgb * vary_pointlight_col; #if HAS_SHADOW vec4 col = vec4(vary_ambient + dlight * shadow, vertex_color_alpha); @@ -246,7 +250,7 @@ void main() LIGHT_LOOP(6) LIGHT_LOOP(7) - color.rgb += diff.rgb * vary_pointlight_col.rgb * col.rgb; + color.rgb += diff.rgb * vary_pointlight_col * col.rgb; frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 6ed2ad5192..247ee0a34f 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -69,8 +69,11 @@ VARYING vec3 vary_ambient; VARYING vec3 vary_directional; VARYING vec3 vary_fragcoord; VARYING vec3 vary_position; -VARYING vec4 vary_pointlight_col; +VARYING vec3 vary_pointlight_col; +#ifdef USE_VERTEX_COLOR +VARYING vec4 vertex_color; +#endif VARYING vec2 vary_texcoord0; @@ -83,6 +86,8 @@ uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; +uniform vec3 sun_dir; + vec3 calcDirectionalLight(vec3 n, vec3 l) { float a = max(dot(n,l),0.0); @@ -183,21 +188,30 @@ void main() - vary_pointlight_col.rgb = diff; - vary_pointlight_col.a = diffuse_color.a; + vary_pointlight_col = diff; + col.rgb = vec3(0,0,0); // Add windlight lights col.rgb = atmosAmbient(col.rgb); + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0-ambient); + + col.rgb *= ambient; + vary_ambient = col.rgb*diff.rgb; vary_directional.rgb = atmosAffectDirectionalLight(1.0f); col.rgb = col.rgb*diff.rgb; - +#ifdef USE_VERTEX_COLOR + vertex_color = col; +#endif #ifdef HAS_SKIN vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 599477ad9e..fc4b8b33f8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -579,6 +579,14 @@ void main() final_da = max(final_da, 0.0f); col.rgb = atmosAmbient(col); + + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0-ambient); + + col.rgb *= ambient; + col.rgb = col.rgb + atmosAffectDirectionalLight(final_da * 2.6); col.rgb *= diffuse.rgb; @@ -625,13 +633,13 @@ void main() #define LIGHT_LOOP(i) col.rgb = col.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_LOOP(1) + LIGHT_LOOP(1) LIGHT_LOOP(2) LIGHT_LOOP(3) LIGHT_LOOP(4) LIGHT_LOOP(5) LIGHT_LOOP(6) - LIGHT_LOOP(7)*/ + LIGHT_LOOP(7) frag_color.rgb = col.rgb; glare = min(glare, 1.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index a1dff9188f..9197df2628 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -301,6 +301,13 @@ void main() calcAtmospherics(pos.xyz, 1.0); col = atmosAmbient(vec3(0)); + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0-ambient); + + col.rgb *= ambient; + col += atmosAffectDirectionalLight(max(min(da, 1.0) * 2.6, diffuse.a)); col *= diffuse.rgb; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index 127c1709b8..13c6ffc607 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -83,6 +83,8 @@ uniform vec3 light_direction[8]; uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; +uniform vec3 sun_dir; + vec3 calcDirectionalLight(vec3 n, vec3 l) { float a = max(dot(n,l),0.0); @@ -190,6 +192,13 @@ void main() // Add windlight lights col.rgb = atmosAmbient(col.rgb); + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0-ambient); + + col.rgb *= ambient; + vary_directional.rgb = atmosAffectDirectionalLight(1.0f); vary_ambient = col.rgb*dff; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 10a598a85c..ee6aaddb00 100755 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -296,7 +296,7 @@ void main() float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); vec4 diffuse = texture2DRect(diffuseRect, tc); - + vec3 col; float bloom = 0.0; @@ -310,6 +310,14 @@ void main() calcAtmospherics(pos.xyz, ambocc); col = atmosAmbient(vec3(0)); + + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0-ambient); + + col *= ambient; + col += atmosAffectDirectionalLight(max(min(da, scol) * 2.6, diffuse.a)); col *= diffuse.rgb; |