diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/windlight')
9 files changed, 262 insertions, 118 deletions
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl index be990c1757..da3d922017 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl @@ -25,7 +25,7 @@ -// varying param funcs +// VARYING param funcs void setSunlitColor(vec3 v); void setAmblitColor(vec3 v); void setAdditiveColor(vec3 v); @@ -34,8 +34,8 @@ void setPositionEye(vec3 v); vec3 getAdditiveColor(); -//varying vec4 vary_CloudUVs; -//varying float vary_CloudDensity; +//VARYING vec4 vary_CloudUVs; +//VARYING float vary_CloudDensity; // Inputs uniform vec4 morphFactor; @@ -47,12 +47,12 @@ uniform vec4 sunlight_color; uniform vec4 ambient; uniform vec4 blue_horizon; uniform vec4 blue_density; -uniform vec4 haze_horizon; -uniform vec4 haze_density; -uniform vec4 cloud_shadow; -uniform vec4 density_multiplier; -uniform vec4 distance_multiplier; -uniform vec4 max_y; +uniform float haze_horizon; +uniform float haze_density; +uniform float cloud_shadow; +uniform float density_multiplier; +uniform float distance_multiplier; +uniform float max_y; uniform vec4 glow; void calcAtmospherics(vec3 inPositionEye) { @@ -61,8 +61,8 @@ void calcAtmospherics(vec3 inPositionEye) { setPositionEye(P); //(TERRAIN) limit altitude - if (P.y > max_y.x) P *= (max_y.x / P.y); - if (P.y < -max_y.x) P *= (-max_y.x / P.y); + if (P.y > max_y) P *= (max_y / P.y); + if (P.y < -max_y) P *= (-max_y / P.y); vec3 tmpLightnorm = lightnorm.xyz; @@ -78,13 +78,13 @@ void calcAtmospherics(vec3 inPositionEye) { //sunlight attenuation effect (hue and brightness) due to atmosphere //this is used later for sunlight modulation at various altitudes - light_atten = (blue_density * 1.0 + vec4(haze_density.r) * 0.25) * (density_multiplier.x * max_y.x); + light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); //I had thought blue_density and haze_density should have equal weighting, //but attenuation due to haze_density tends to seem too strong - temp1 = blue_density + vec4(haze_density.r); + temp1 = blue_density + vec4(haze_density); blue_weight = blue_density / temp1; - haze_weight = vec4(haze_density.r) / temp1; + haze_weight = vec4(haze_density) / temp1; //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) temp2.y = max(0.0, tmpLightnorm.y); @@ -92,12 +92,12 @@ void calcAtmospherics(vec3 inPositionEye) { sunlight *= exp( - light_atten * temp2.y); // main atmospheric scattering line integral - temp2.z = Plen * density_multiplier.x; + temp2.z = Plen * density_multiplier; // Transparency (-> temp1) - // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier.x in a variable because the ati + // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati // compiler gets confused. - temp1 = exp(-temp1 * temp2.z * distance_multiplier.x); + temp1 = exp(-temp1 * temp2.z * distance_multiplier); //final atmosphere attenuation factor setAtmosAttenuation(temp1.rgb); @@ -122,12 +122,12 @@ void calcAtmospherics(vec3 inPositionEye) { //increase ambient when there are more clouds - vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow.x * 0.5; + vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5; //haze color setAdditiveColor( - vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow.x) + tmpAmbient) - + (haze_horizon.r * haze_weight) * (sunlight*(1.-cloud_shadow.x) * temp2.x + vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient) + + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x + tmpAmbient))); //brightness of surface both sunlight and ambient diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index a98c04b259..765b0927c3 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -24,25 +24,17 @@ */ +VARYING vec3 vary_SunlitColor; +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; -varying vec3 vary_PositionEye; - -varying vec3 vary_SunlitColor; -varying vec3 vary_AmblitColor; -varying vec3 vary_AdditiveColor; -varying vec3 vary_AtmosAttenuation; - -vec3 getPositionEye() -{ - return vary_PositionEye; -} vec3 getSunlitColor() { - return vary_SunlitColor; + return vec3(0,0,0); } vec3 getAmblitColor() { - return vary_AmblitColor; + return vec3(0,0,0); } vec3 getAdditiveColor() { @@ -50,5 +42,5 @@ vec3 getAdditiveColor() } vec3 getAtmosAttenuation() { - return vary_AtmosAttenuation; + return vec3(vary_AtmosAttenuation); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 7c3cb88b3c..99dbee15ee 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -24,57 +24,61 @@ */ +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; -varying vec3 vary_PositionEye; +vec3 additive_color; +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; +vec3 position_eye; -varying vec3 vary_SunlitColor; -varying vec3 vary_AmblitColor; -varying vec3 vary_AdditiveColor; -varying vec3 vary_AtmosAttenuation; - -vec3 getPositionEye() -{ - return vary_PositionEye; -} vec3 getSunlitColor() { - return vary_SunlitColor; + return sunlit_color; } vec3 getAmblitColor() { - return vary_AmblitColor; + return amblit_color; } + vec3 getAdditiveColor() { - return vary_AdditiveColor; + return additive_color; } vec3 getAtmosAttenuation() { - return vary_AtmosAttenuation; + return atmos_attenuation; } +vec3 getPositionEye() +{ + return position_eye; +} void setPositionEye(vec3 v) { - vary_PositionEye = v; + position_eye = v; } void setSunlitColor(vec3 v) { - vary_SunlitColor = v; + sunlit_color = v; } void setAmblitColor(vec3 v) { - vary_AmblitColor = v; + amblit_color = v; } void setAdditiveColor(vec3 v) { + additive_color = v; vary_AdditiveColor = v; } void setAtmosAttenuation(vec3 v) { + atmos_attenuation = v; vary_AtmosAttenuation = v; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl new file mode 100644 index 0000000000..163ef26444 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl @@ -0,0 +1,50 @@ +/** + * @file atmosphericVarsWaterF.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$ + */ + +VARYING vec3 vary_PositionEye; +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; + +vec3 getSunlitColor() +{ + return vec3(0,0,0); +} +vec3 getAmblitColor() +{ + return vec3(0,0,0); +} +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return vary_AtmosAttenuation; +} +vec3 getPositionEye() +{ + return vary_PositionEye; +} + diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl new file mode 100644 index 0000000000..553f6752e6 --- /dev/null +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl @@ -0,0 +1,81 @@ +/** + * @file atmosphericVarsWaterV.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$ + */ + +VARYING vec3 vary_PositionEye; +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; + +vec3 atmos_attenuation; +vec3 sunlit_color; +vec3 amblit_color; + +vec3 getSunlitColor() +{ + return sunlit_color; +} +vec3 getAmblitColor() +{ + return amblit_color; +} + +vec3 getAdditiveColor() +{ + return vary_AdditiveColor; +} +vec3 getAtmosAttenuation() +{ + return atmos_attenuation; +} + +vec3 getPositionEye() +{ + return vary_PositionEye; +} + +void setPositionEye(vec3 v) +{ + vary_PositionEye = v; +} + +void setSunlitColor(vec3 v) +{ + sunlit_color = v; +} + +void setAmblitColor(vec3 v) +{ + amblit_color = v; +} + +void setAdditiveColor(vec3 v) +{ + vary_AdditiveColor = v; +} + +void setAtmosAttenuation(vec3 v) +{ + atmos_attenuation = v; + vary_AtmosAttenuation = v; +} diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index b90cec119b..96c70651b1 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -23,15 +23,23 @@ * $/LicenseInfo$ */ - +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif ///////////////////////////////////////////////////////////////////////// // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -varying vec4 vary_CloudColorSun; -varying vec4 vary_CloudColorAmbient; -varying float vary_CloudDensity; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; uniform sampler2D cloud_noise_texture; uniform vec4 cloud_pos_density1; @@ -50,14 +58,14 @@ vec3 scaleSoftClip(vec3 light) { void main() { // Set variables - vec2 uv1 = gl_TexCoord[0].xy; - vec2 uv2 = gl_TexCoord[1].xy; + vec2 uv1 = vary_texcoord0.xy; + vec2 uv2 = vary_texcoord1.xy; vec4 cloudColorSun = vary_CloudColorSun; vec4 cloudColorAmbient = vary_CloudColorAmbient; float cloudDensity = vary_CloudDensity; - vec2 uv3 = gl_TexCoord[2].xy; - vec2 uv4 = gl_TexCoord[3].xy; + vec2 uv3 = vary_texcoord2.xy; + vec2 uv4 = vary_texcoord3.xy; // Offset texture coords uv1 += cloud_pos_density1.xy; //large texture, visible density @@ -90,7 +98,7 @@ void main() color *= 2.; /// Gamma correct for WL (soft clip effect). - gl_FragColor.rgb = scaleSoftClip(color.rgb); - gl_FragColor.a = alpha1; + frag_color.rgb = scaleSoftClip(color.rgb); + frag_color.a = alpha1; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index c175a834c2..c1dd45cd67 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -22,17 +22,24 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; ////////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky /////////////////////////////////////////////////////////////////////////////// // Output parameters -varying vec4 vary_CloudColorSun; -varying vec4 vary_CloudColorAmbient; -varying float vary_CloudDensity; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; // Inputs uniform vec3 camPosLocal; @@ -42,34 +49,34 @@ uniform vec4 sunlight_color; uniform vec4 ambient; uniform vec4 blue_horizon; uniform vec4 blue_density; -uniform vec4 haze_horizon; -uniform vec4 haze_density; +uniform float haze_horizon; +uniform float haze_density; -uniform vec4 cloud_shadow; -uniform vec4 density_multiplier; -uniform vec4 max_y; +uniform float cloud_shadow; +uniform float density_multiplier; +uniform float max_y; uniform vec4 glow; uniform vec4 cloud_color; -uniform vec4 cloud_scale; +uniform float cloud_scale; void main() { // World / view / projection - gl_Position = ftransform(); + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = gl_MultiTexCoord0; + vary_texcoord0 = texcoord0; // Get relative position - vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); + vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); // Set altitude if (P.y > 0.) { - P *= (max_y.x / P.y); + P *= (max_y / P.y); } else { @@ -91,12 +98,12 @@ void main() // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes - light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x); + light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); // Calculate relative weights - temp1 = blue_density + haze_density.x; + temp1 = blue_density + haze_density; blue_weight = blue_density / temp1; - haze_weight = haze_density.x / temp1; + haze_weight = haze_density / temp1; // Compute sunlight from P & lightnorm (for long rays like sky) temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y ); @@ -104,7 +111,7 @@ void main() sunlight *= exp( - light_atten * temp2.y); // Distance - temp2.z = Plen * density_multiplier.x; + temp2.z = Plen * density_multiplier; // Transparency (-> temp1) // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati @@ -128,14 +135,14 @@ void main() // Increase ambient when there are more clouds vec4 tmpAmbient = ambient; - tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; // Dim sunlight by cloud shadow percentage - sunlight *= (1. - cloud_shadow.x); + sunlight *= (1. - cloud_shadow); // Haze color below cloud vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient) - + (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient) + + (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient) ); // CLOUDS @@ -156,21 +163,21 @@ void main() vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - temp1); // Make a nice cloud density based on the cloud_shadow value that was passed in. - vary_CloudDensity = 2. * (cloud_shadow.x - 0.25); + vary_CloudDensity = 2. * (cloud_shadow - 0.25); // Texture coords - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_TexCoord[0].xy -= 0.5; - gl_TexCoord[0].xy /= cloud_scale.x; - gl_TexCoord[0].xy += 0.5; + vary_texcoord0 = texcoord0; + vary_texcoord0.xy -= 0.5; + vary_texcoord0.xy /= cloud_scale; + vary_texcoord0.xy += 0.5; - gl_TexCoord[1] = gl_TexCoord[0]; - gl_TexCoord[1].x += lightnorm.x * 0.0125; - gl_TexCoord[1].y += lightnorm.z * 0.0125; + vary_texcoord1 = vary_texcoord0; + vary_texcoord1.x += lightnorm.x * 0.0125; + vary_texcoord1.y += lightnorm.z * 0.0125; - gl_TexCoord[2] = gl_TexCoord[0] * 16.; - gl_TexCoord[3] = gl_TexCoord[1] * 16.; + vary_texcoord2 = vary_texcoord0 * 16.; + vary_texcoord3 = vary_texcoord1 * 16.; // Combine these to minimize register use vary_CloudColorAmbient += oHazeColorBelowCloud; diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl index ac569e8257..e2a2367626 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl @@ -23,13 +23,17 @@ * $/LicenseInfo$ */ - +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif ///////////////////////////////////////////////////////////////////////// // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -varying vec4 vary_HazeColor; +VARYING vec4 vary_HazeColor; uniform sampler2D cloud_noise_texture; uniform vec4 gamma; @@ -55,7 +59,7 @@ void main() color *= 2.; /// Gamma correct for WL (soft clip effect). - gl_FragColor.rgb = scaleSoftClip(color.rgb); - gl_FragColor.a = 1.0; + frag_color.rgb = scaleSoftClip(color.rgb); + frag_color.a = 1.0; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl index 3a44bb6d26..3788ddaf2d 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl @@ -23,14 +23,16 @@ * $/LicenseInfo$ */ +uniform mat4 modelview_projection_matrix; +ATTRIBUTE vec3 position; // SKY //////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky /////////////////////////////////////////////////////////////////////////////// // Output parameters -varying vec4 vary_HazeColor; +VARYING vec4 vary_HazeColor; // Inputs uniform vec3 camPosLocal; @@ -40,34 +42,31 @@ uniform vec4 sunlight_color; uniform vec4 ambient; uniform vec4 blue_horizon; uniform vec4 blue_density; -uniform vec4 haze_horizon; -uniform vec4 haze_density; +uniform float haze_horizon; +uniform float haze_density; -uniform vec4 cloud_shadow; -uniform vec4 density_multiplier; -uniform vec4 max_y; +uniform float cloud_shadow; +uniform float density_multiplier; +uniform float max_y; uniform vec4 glow; uniform vec4 cloud_color; -uniform vec4 cloud_scale; - void main() { // World / view / projection - gl_Position = ftransform(); - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); // Get relative position - vec3 P = gl_Vertex.xyz - camPosLocal.xyz + vec3(0,50,0); - //vec3 P = gl_Vertex.xyz + vec3(0,50,0); + vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); + //vec3 P = position.xyz + vec3(0,50,0); // Set altitude if (P.y > 0.) { - P *= (max_y.x / P.y); + P *= (max_y / P.y); } else { @@ -86,15 +85,14 @@ void main() vec4 sunlight = sunlight_color; vec4 light_atten; - // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes - light_atten = (blue_density * 1.0 + haze_density.x * 0.25) * (density_multiplier.x * max_y.x); + light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); // Calculate relative weights - temp1 = blue_density + haze_density.x; + temp1 = blue_density + haze_density; blue_weight = blue_density / temp1; - haze_weight = haze_density.x / temp1; + haze_weight = haze_density / temp1; // Compute sunlight from P & lightnorm (for long rays like sky) temp2.y = max(0., max(0., Pn.y) * 1.0 + lightnorm.y ); @@ -102,7 +100,7 @@ void main() sunlight *= exp( - light_atten * temp2.y); // Distance - temp2.z = Plen * density_multiplier.x; + temp2.z = Plen * density_multiplier; // Transparency (-> temp1) // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati @@ -127,20 +125,20 @@ void main() // Haze color above cloud vary_HazeColor = ( blue_horizon * blue_weight * (sunlight + ambient) - + (haze_horizon.r * haze_weight) * (sunlight * temp2.x + ambient) + + (haze_horizon * haze_weight) * (sunlight * temp2.x + ambient) ); // Increase ambient when there are more clouds vec4 tmpAmbient = ambient; - tmpAmbient += (1. - tmpAmbient) * cloud_shadow.x * 0.5; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; // Dim sunlight by cloud shadow percentage - sunlight *= (1. - cloud_shadow.x); + sunlight *= (1. - cloud_shadow); // Haze color below cloud vec4 additiveColorBelowCloud = ( blue_horizon * blue_weight * (sunlight + tmpAmbient) - + (haze_horizon.r * haze_weight) * (sunlight * temp2.x + tmpAmbient) + + (haze_horizon * haze_weight) * (sunlight * temp2.x + tmpAmbient) ); // Final atmosphere additive |