diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index ae1ac5de7f..f6870c3ff0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -24,41 +24,34 @@ */ /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; -#else -#define frag_data gl_FragData -#endif +out vec4 frag_data[4]; ///////////////////////////////////////////////////////////////////////// // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -VARYING vec4 vary_CloudColorSun; -VARYING vec4 vary_CloudColorAmbient; -VARYING float vary_CloudDensity; +in vec3 vary_CloudColorSun; +in vec3 vary_CloudColorAmbient; +in float vary_CloudDensity; uniform sampler2D cloud_noise_texture; uniform sampler2D cloud_noise_texture_next; uniform float blend_factor; -uniform vec4 cloud_pos_density1; -uniform vec4 cloud_pos_density2; +uniform vec3 cloud_pos_density1; +uniform vec3 cloud_pos_density2; uniform float cloud_scale; uniform float cloud_variance; -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; -VARYING vec2 vary_texcoord2; -VARYING vec2 vary_texcoord3; -VARYING float altitude_blend_factor; - -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); +in vec2 vary_texcoord0; +in vec2 vary_texcoord1; +in vec2 vary_texcoord2; +in vec2 vary_texcoord3; +in float altitude_blend_factor; vec4 cloudNoise(vec2 uv) { - vec4 a = texture2D(cloud_noise_texture, uv); - vec4 b = texture2D(cloud_noise_texture_next, uv); + vec4 a = texture(cloud_noise_texture, uv); + vec4 b = texture(cloud_noise_texture_next, uv); vec4 cloud_noise_sample = mix(a, b, blend_factor); return cloud_noise_sample; } @@ -69,8 +62,8 @@ void main() vec2 uv1 = vary_texcoord0.xy; vec2 uv2 = vary_texcoord1.xy; - vec4 cloudColorSun = vary_CloudColorSun; - vec4 cloudColorAmbient = vary_CloudColorAmbient; + vec3 cloudColorSun = vary_CloudColorSun; + vec3 cloudColorAmbient = vary_CloudColorAmbient; float cloudDensity = vary_CloudDensity; vec2 uv3 = vary_texcoord2.xy; vec2 uv4 = vary_texcoord3.xy; @@ -115,17 +108,15 @@ void main() alpha2 = 1. - alpha2 * alpha2; // Combine - vec4 color; + vec3 color; color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient); - color.rgb= max(vec3(0), color.rgb); + color.rgb = clamp(color.rgb, vec3(0), vec3(1)); color.rgb *= 2.0; - color.rgb = scaleSoftClip(color.rgb); /// Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(color.rgb, alpha1); + frag_data[0] = vec4(0); frag_data[1] = vec4(0.0,0.0,0.0,0.0); - frag_data[2] = vec4(0,0,0,1); - - gl_FragDepth = 0.99995f; + frag_data[2] = vec4(0,0,0,GBUFFER_FLAG_SKIP_ATMOS); + frag_data[3] = vec4(color.rgb, alpha1); } |