diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
3 files changed, 20 insertions, 33 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 393074344b..9ce4d89df7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -136,20 +136,15 @@ uniform vec3 light_attenuation[8]; uniform vec3 light_diffuse[8]; #ifdef WATER_FOG -vec3 getPositionEye() -{ - return vary_PositionEye; -} - uniform vec4 waterPlane; uniform vec4 waterFogColor; uniform float waterFogDensity; uniform float waterFogKS; -vec4 applyWaterFogDeferred(vec4 color) +vec4 applyWaterFogDeferred(vec3 pos, vec4 color) { //normalize view vector - vec3 view = normalize(getPositionEye()); + vec3 view = normalize(pos); float es = -(dot(view, waterPlane.xyz)); //find intersection point with water plane and eye vector @@ -160,7 +155,7 @@ vec4 applyWaterFogDeferred(vec4 color) vec3 int_v = waterPlane.w > 0.0 ? view * waterPlane.w/es : vec3(0.0, 0.0, 0.0); //get object depth - float depth = length(getPositionEye() - int_v); + float depth = length(pos - int_v); //get "thickness" of water float l = max(depth, 0.1); @@ -463,21 +458,6 @@ out vec4 frag_data[3]; #else #define frag_data gl_FragData #endif - -VARYING vec3 vary_position; - -#ifdef WATER_FOG -vec3 vary_PositionEye; -vec3 getPositionEye() -{ - return vary_PositionEye; -} -void setPositionEye(vec3 e) -{ - vary_PositionEye = e; -} -#endif - #endif uniform sampler2D diffuseMap; @@ -749,15 +729,18 @@ void main() float al = max(diffcol.a,glare)*vertex_color.a; #ifdef WATER_FOG - frag_color = applyWaterFogDeferred(vec4(col.rgb, al)); -#else + vec4 temp = applyWaterFogDeferred(pos, vec4(col.rgb, al)); + col.rgb = temp.rgb; + al = temp.a; +#endif + frag_color.rgb = col.rgb; frag_color.a = al; -#endif #else frag_data[0] = final_color; frag_data[1] = final_specular; // XYZ = Specular color. W = Specular exponent. frag_data[2] = final_normal; // XY = Normal. Z = Env. intensity. -#endif% +#endif } + diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl index 154db09583..e44a6fcec8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialV.glsl @@ -141,3 +141,4 @@ vary_normal = n; #endif #endif } + diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 1706d41da0..953f0189f0 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -133,6 +133,7 @@ vec3 getPositionEye() { return vary_PositionEye; } + vec3 getSunlitColor() { return vary_SunlitColor; @@ -182,10 +183,10 @@ uniform vec4 waterFogColor; uniform float waterFogDensity; uniform float waterFogKS; -vec4 applyWaterFogDeferred(vec4 color) +vec4 applyWaterFogDeferred(vec3 pos, vec4 color) { //normalize view vector - vec3 view = normalize(getPositionEye()); + vec3 view = normalize(pos); float es = -(dot(view, waterPlane.xyz)); //find intersection point with water plane and eye vector @@ -196,7 +197,7 @@ vec4 applyWaterFogDeferred(vec4 color) vec3 int_v = waterPlane.w > 0.0 ? view * waterPlane.w/es : vec3(0.0, 0.0, 0.0); //get object depth - float depth = length(getPositionEye() - int_v); + float depth = length(pos - int_v); //get "thickness" of water float l = max(depth, 0.1); @@ -435,13 +436,14 @@ void main() if (norm.w < 0.5) { col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a); - col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); #ifdef WATER_FOG - vec4 fogged = applyWaterFogDeferred(vec4(col, bloom)); + vec4 fogged = applyWaterFogDeferred(pos,vec4(col, bloom)); col = fogged.rgb; bloom = fogged.a; #endif + + col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); } col = srgb_to_linear(col); @@ -450,6 +452,7 @@ void main() //col.g = envIntensity; } - frag_color.rgb = col; + frag_color.rgb = col.rgb; frag_color.a = bloom; } + |