diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
17 files changed, 75 insertions, 705 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl deleted file mode 100644 index bbdc8fdd1c..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl +++ /dev/null @@ -1,112 +0,0 @@ -/**  - * @file avatarAlphaNoColorV.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$ - */ - -uniform mat4 projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec3 normal; -ATTRIBUTE vec2 texcoord0; - -mat4 getSkinnedTransform(); -void calcAtmospherics(vec3 inPositionEye); - -float calcDirectionalLight(vec3 n, vec3 l); - -vec3 atmosAmbient(); -vec3 atmosAffectDirectionalLight(float lightIntensity); - -VARYING vec3 vary_position; -VARYING vec3 vary_ambient; -VARYING vec3 vary_directional; -VARYING vec3 vary_fragcoord; -VARYING vec3 vary_pointlight_col; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_norm; - - -uniform float near_clip; - -uniform vec4 color; - -uniform vec4 light_position[8]; -uniform vec3 light_direction[8]; -uniform vec3 light_attenuation[8];  -uniform vec3 light_diffuse[8]; - -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight); - -void main() -{ -	vary_texcoord0 = texcoord0; -				 -	vec4 pos; -	vec3 norm; -	 -	mat4 trans = getSkinnedTransform(); -	vec4 pos_in = vec4(position.xyz, 1.0); -	pos.x = dot(trans[0], pos_in); -	pos.y = dot(trans[1], pos_in); -	pos.z = dot(trans[2], pos_in); -	pos.w = 1.0; -	 -	norm.x = dot(trans[0].xyz, normal); -	norm.y = dot(trans[1].xyz, normal); -	norm.z = dot(trans[2].xyz, normal); -	norm = normalize(norm); -	vary_norm = norm; -		 -	vec4 frag_pos = projection_matrix * pos; -	gl_Position = frag_pos; -	 -	vary_position = pos.xyz; -	 -	calcAtmospherics(pos.xyz); - -	vec4 col = vec4(0.0, 0.0, 0.0, 1.0); - -	// Collect normal lights -	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].y, light_attenuation[2].z); -	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].y, light_attenuation[3].z); -	col.rgb += light_diffuse[4].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[4], light_direction[4], light_attenuation[4].x, light_attenuation[4].y, light_attenuation[4].z); -	col.rgb += light_diffuse[5].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[5], light_direction[5], light_attenuation[5].x, light_attenuation[5].y, 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].y, 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].y, light_attenuation[7].z); -	 -	vary_pointlight_col = col.rgb*color.rgb; - -	col.rgb = vec3(0,0,0); - -	// Add windlight lights -	col.rgb = atmosAmbient(); -	 -	vary_ambient = col.rgb*color.rgb; -	vary_directional = color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, light_position[0].xyz), 0.0)); -	 -	col.rgb = col.rgb * color.rgb; -	 -	vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); -} - - diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudShadowF.glsl deleted file mode 100644 index 0157d166e0..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudShadowF.glsl +++ /dev/null @@ -1,127 +0,0 @@ -/**  - * @file class3/deferred/cloudsF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ -  -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseMap; - -VARYING vec4 pos; -VARYING float target_pos_x; -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 sampler2D cloud_noise_texture_next; -uniform float blend_factor; -uniform vec4 cloud_pos_density1; -uniform vec4 cloud_pos_density2; -uniform vec4 sunlight_color; -uniform vec4 cloud_color; -uniform float cloud_shadow; -uniform float cloud_scale; -uniform float cloud_variance; -uniform vec3 camPosLocal; -uniform vec3 sun_dir; -uniform float sun_size; -uniform float far_z; - -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif - -vec4 cloudNoise(vec2 uv) -{ -   vec4 a = texture2D(cloud_noise_texture, uv); -   vec4 b = texture2D(cloud_noise_texture_next, uv); -   vec4 cloud_noise_sample = mix(a, b, blend_factor); -   return normalize(cloud_noise_sample); -} - -void main() -{ -    // Set variables -    vec2 uv1 = vary_texcoord0.xy; -    vec2 uv2 = vary_texcoord1.xy; -    vec2 uv3 = vary_texcoord2.xy; -    float cloudDensity = 2.0 * (cloud_shadow - 0.25); - -    if (cloud_scale >= 0.0001) -    { -        vec2 uv4 = vary_texcoord3.xy; -     -        vec2 disturbance  = vec2(cloudNoise(uv1 / 8.0f).x, cloudNoise((uv3 + uv1) / 16.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); -        vec2 disturbance2 = vec2(cloudNoise((uv1 + uv3) / 4.0f).x, cloudNoise((uv4 + uv2) / 8.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); -     -        // Offset texture coords -        uv1 += cloud_pos_density1.xy + (disturbance * 0.2);    //large texture, visible density -        uv2 += cloud_pos_density1.xy;   //large texture, self shadow -        uv3 += cloud_pos_density2.xy;   //small texture, visible density -        uv4 += cloud_pos_density2.xy;   //small texture, self shadow -     -        float density_variance = min(1.0, (disturbance.x* 2.0 + disturbance.y* 2.0 + disturbance2.x + disturbance2.y) * 4.0); -     -        cloudDensity *= 1.0 - (density_variance * density_variance); -     -        // Compute alpha1, the main cloud opacity -        float alpha1 = (cloudNoise(uv1).x - 0.5) + (cloudNoise(uv3).x - 0.5) * cloud_pos_density2.z; -        alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10 * cloud_pos_density1.z, 1.); -     -        // And smooth -        alpha1 = 1. - alpha1 * alpha1; -        alpha1 = 1. - alpha1 * alpha1;   -     -        if (alpha1 < 0.001f) -        { -            discard; -        } -     -        // Compute alpha2, for self shadowing effect -        // (1 - alpha2) will later be used as percentage of incoming sunlight -        float alpha2 = (cloudNoise(uv2).x - 0.5); -        alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); -     -        // And smooth -        alpha2 = 1. - alpha2; -        alpha2 = 1. - alpha2 * alpha2;   -     -        frag_color = vec4(alpha1, alpha1, alpha1, 1); -    } -    else -    { -        frag_color = vec4(1); -    } - -#if !defined(DEPTH_CLAMP) -    gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); -#endif - -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudShadowV.glsl deleted file mode 100644 index effb070f93..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudShadowV.glsl +++ /dev/null @@ -1,63 +0,0 @@ -/**  - * @file cloudShadowV.glsl - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -uniform mat4 texture_matrix0; -uniform mat4 modelview_projection_matrix; -uniform float shadow_target_width; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec2 texcoord0; - -#if !defined(DEPTH_CLAMP) -VARYING float pos_zd2; -#endif - -VARYING vec4 pos; -VARYING float target_pos_x; -VARYING vec2 vary_texcoord0; -VARYING vec4 vertex_color; - -void passTextureIndex(); - -void main() -{ -	//transform vertex -	vec4 pre_pos = vec4(position.xyz, 1.0); -	pos = modelview_projection_matrix * pre_pos; -	target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; - -#if !defined(DEPTH_CLAMP) -	pos_zd2 = pos.z * 0.5; -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else -	gl_Position = pos; -#endif -	 -	passTextureIndex(); - -	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; -	vertex_color = diffuse_color; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index ae1ac5de7f..f1187fef9a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -126,6 +126,6 @@ void main()      frag_data[1] = vec4(0.0,0.0,0.0,0.0);      frag_data[2] = vec4(0,0,0,1); -    gl_FragDepth = 0.99995f; +    gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 Stars and Clouds need same depth  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 35068899ee..e709d73bfa 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -55,6 +55,12 @@ void main()          fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 );      vec4 c      = texture2D(diffuseMap, vary_texcoord0.xy); + +    // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible +    // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> +    if (c.a <= 2./255.) // 0.00784 +        discard; +  //       c.rgb  = srgb_to_linear(c.rgb);           c.rgb *= moonlight_color.rgb;           c.rgb *= moon_brightness; @@ -68,6 +74,6 @@ void main()      frag_data[1] = vec4(0.0);      frag_data[2] = vec4(0.0f); -    gl_FragDepth = 0.999985f; +    gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl deleted file mode 100644 index cf994d3547..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl +++ /dev/null @@ -1,99 +0,0 @@ -/**  - * @file postgiF.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$ - */ - -/*[EXTRA_CODE_HERE]*/ - - #ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif -  -uniform sampler2DRect depthMap; -uniform sampler2DRect normalMap; -uniform sampler2DRect giLightMap; -uniform sampler2D	noiseMap; - -uniform vec2 kern[32]; -uniform float dist_factor; -uniform float blur_size; -uniform vec2 delta; -uniform int kern_length; -uniform float kern_scale; -uniform vec3 blur_quad; - -VARYING vec2 vary_fragcoord; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -vec4 getPosition(vec2 pos_screen); - -void main()  -{ -	vec3 norm = texture2DRect(normalMap, vary_fragcoord.xy).xyz; -	norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm -	vec3 pos = getPosition(vary_fragcoord.xy).xyz; -	 -	vec3 ccol = texture2DRect(giLightMap, vary_fragcoord.xy).rgb; -	vec2 dlt = kern_scale * delta/(1.0+norm.xy*norm.xy); -	dlt /= max(-pos.z*dist_factor, 1.0); -	float defined_weight = kern[0].x; -	vec3 col = vec3(0.0); -	 -	for (int i = 0; i < kern_length; i++) -	{ -		vec2 tc = vary_fragcoord.xy + kern[i].y*dlt; -		vec3 sampNorm = texture2DRect(normalMap, tc.xy).xyz; -		sampNorm = vec3((sampNorm.xy-0.5)*2.0,sampNorm.z); // unpack norm -	     -		float d = dot(norm.xyz, sampNorm); -		 -		if (d > 0.8) -		{ -			vec3 samppos = getPosition(tc.xy).xyz; -			samppos -= pos; -			if (dot(samppos,samppos) < -0.05*pos.z) -			{ -	    		col += texture2DRect(giLightMap, tc).rgb*kern[i].x; -				defined_weight += kern[i].x; -			} -		} -	} - -	col /= defined_weight; -	 -	//col = ccol; -	 -	col = col*col*blur_quad.x + col*blur_quad.y + blur_quad.z; -	 -	frag_color.rgb = col; - -#ifdef IS_AMD_CARD -	// If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. -	vec2 dummy1 = kern[0]; -	vec2 dummy2 = kern[31]; -#endif -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaBlendV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaBlendV.glsl deleted file mode 100644 index f45c343066..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaBlendV.glsl +++ /dev/null @@ -1,67 +0,0 @@ -/**  - * @file shadowAlphaMaskV.glsl - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -uniform mat4 texture_matrix0; -uniform mat4 modelview_projection_matrix; -uniform float shadow_target_width; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec2 texcoord0; - -#if !defined(DEPTH_CLAMP) -VARYING float pos_zd2; -#endif - -VARYING float pos_w; - -VARYING float target_pos_x; -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; - -void passTextureIndex(); - -void main() -{ -	//transform vertex -	vec4 pre_pos = vec4(position.xyz, 1.0); -	vec4 pos = modelview_projection_matrix * pre_pos; -	target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; - -	pos_w = pos.w; - -#if !defined(DEPTH_CLAMP) -	pos_zd2 = pos.z * 0.5; -	 -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else -	gl_Position = pos; -#endif -	 -	passTextureIndex(); - -	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; -	vertex_color = diffuse_color; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl index bac79a9fdc..8d9c7e3507 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -46,8 +46,13 @@ float twinkle(){      return abs(d);  } +// See: +// ALM off: class1/environment/starsF.glsl +// ALM on : class1/deferred/starsF.glsl  void main()   { +	// camera above water: class1\deferred\starsF.glsl +	// camera below water: class1\environment\starsF.glsl      vec4 col_a = texture2D(diffuseMap, vary_texcoord0.xy);      vec4 col_b = texture2D(diffuseMap, vary_texcoord0.xy);      vec4 col = mix(col_b, col_a, blend_factor); @@ -62,6 +67,6 @@ void main()      frag_data[1] = vec4(0.0f);      frag_data[2] = vec4(0.0, 1.0, 0.0, 1.0); -    gl_FragDepth = 0.99995f; +    gl_FragDepth = LL_SHADER_CONST_STAR_DEPTH; // SL-14113 Moon Haze -- Stars need to depth test behind the moon  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl index 8863869e44..38276859a0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl @@ -70,7 +70,7 @@ void main()  	d *= d;  	oPosition = vec4(position, 1.0); -	oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); +//	oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); // SL-11589 remove "U" shaped horizon  	vary_position = modelview_matrix * oPosition;  	oPosition = modelViewProj * oPosition; diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/environment/moonF.glsl index be1003a7e0..a220971f06 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/moonF.glsl @@ -1,9 +1,9 @@  /**  - * @file luminanceF.glsl + * @file class1/environment/moonF.glsl   * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2021&license=viewerlgpl$   * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. + * Copyright (C) 2021, 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 @@ -23,18 +23,29 @@   * $/LicenseInfo$   */ -/*[EXTRA_CODE_HERE]*/ -  #ifdef DEFINE_GL_FRAGCOLOR  out vec4 frag_color;  #else  #define frag_color gl_FragColor  #endif -uniform sampler2DRect diffuseMap; -VARYING vec2 vary_fragcoord; +uniform sampler2D tex0; + +VARYING vec2 vary_texcoord0; +// See: +// AS  off: class1/environment/moonF.glsl +// ALM off: class1/windlight/moonF.glsl +// ALM on : class1/deferred/moonF.glsl  void main()   { -	frag_color = texture2DRect(diffuseMap, vary_fragcoord.xy); +    vec4 color = texture2D(tex0, vary_texcoord0.xy); + +    // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible +    // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> +    if (color.a <= 2./255.) // 0.00784 +        discard; + +    frag_color = color; +    gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113 Moon is infront of stars  } diff --git a/indra/newview/app_settings/shaders/class1/objects/indexedTextureF.glsl b/indra/newview/app_settings/shaders/class1/environment/moonV.glsl index 254c1d4fc2..1fc421a295 100644 --- a/indra/newview/app_settings/shaders/class1/objects/indexedTextureF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/moonV.glsl @@ -1,9 +1,9 @@  /**  - * @file fullbrightF.glsl + * @file class1\environment\moonV.glsl   * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2021&license=viewerlgpl$   * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. + * Copyright (C) 2021, 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 @@ -23,11 +23,16 @@   * $/LicenseInfo$   */ -  +uniform mat4 modelview_projection_matrix; + +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +VARYING vec2 vary_texcoord0; -void main()  +void main()  { -	fullbright_lighting(); +	gl_Position = modelview_projection_matrix * vec4(position, 1); +	vary_texcoord0 = texcoord0;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaBlendF.glsl b/indra/newview/app_settings/shaders/class1/environment/starsF.glsl index 44f2a73e1f..e1a9cc6387 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaBlendF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/starsF.glsl @@ -1,9 +1,9 @@  /**  - * @file shadowAlphaMaskF.glsl + * @file class1/environment/starsF.glsl   * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * $LicenseInfo:firstyear=2021&license=viewerlgpl$   * Second Life Viewer Source Code - * Copyright (C) 2011, Linden Research, Inc. + * Copyright (C) 2021, 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 @@ -23,8 +23,6 @@   * $/LicenseInfo$   */ -/*[EXTRA_CODE_HERE]*/ -  #ifdef DEFINE_GL_FRAGCOLOR  out vec4 frag_color;  #else @@ -33,23 +31,21 @@ out vec4 frag_color;  uniform sampler2D diffuseMap; -#if !defined(DEPTH_CLAMP) -VARYING float pos_zd2; -#endif - -VARYING float pos_w; +uniform float custom_alpha; -VARYING float target_pos_x;  VARYING vec4 vertex_color;  VARYING vec2 vary_texcoord0; +// See: +// ALM off: class1/environment/starsF.glsl +// ALM on : class1/deferred/starsF.glsl  void main()   { -	float alpha = diffuseLookup(vary_texcoord0.xy).a * vertex_color.a; +    vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); +    color.rgb = pow(color.rgb, vec3(0.45)); +    color.rgb *= vertex_color.rgb; +    color.a *= max(custom_alpha, vertex_color.a); -	frag_color = vec4(alpha, alpha, alpha, 1); -	 -#if !defined(DEPTH_CLAMP) -	gl_FragDepth = max(pos_zd2/pos_w+0.5, 0.0); -#endif +    frag_color = color; +    gl_FragDepth = LL_SHADER_CONST_STAR_DEPTH; // SL-14113 Moon Haze -- Stars need to depth test behind the moon  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/environment/starsV.glsl index f2dc60aa5d..6fcfec6b6a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/starsV.glsl @@ -1,9 +1,9 @@  /**  - * @file giV.glsl + * @file class1/environment/starsV.glsl   * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2021&license=viewerlgpl$   * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. + * Copyright (C) 2021, 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 @@ -24,22 +24,18 @@   */  uniform mat4 modelview_projection_matrix; -  +  ATTRIBUTE vec3 position;  ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; -VARYING vec2 vary_fragcoord;  VARYING vec4 vertex_color; - -uniform vec2 screen_res; +VARYING vec2 vary_texcoord0;  void main()  { -	//transform vertex -	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); -	gl_Position = pos; -	 -	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	 - +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); +	vary_texcoord0 = texcoord0;  	vertex_color = diffuse_color;  } + diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index cc41e3f740..35770d3341 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -68,7 +68,7 @@ void main()  	d *= d;  	oPosition = vec4(position, 1.0); -	oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); +//	oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); // SL-11589 remove "U" shaped horizon  	oPosition = modelViewProj * oPosition;  	refCoord.xyz = oPosition.xyz + vec3(0,0,0.2); diff --git a/indra/newview/app_settings/shaders/class1/windlight/cloudShadowF.glsl b/indra/newview/app_settings/shaders/class1/windlight/cloudShadowF.glsl deleted file mode 100644 index 82fad4db5a..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/cloudShadowF.glsl +++ /dev/null @@ -1,127 +0,0 @@ -/**  - * @file class1/windlight/cloudShadowF.glsl - * - * $LicenseInfo:firstyear=2005&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2005, 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$ - */ -  -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseMap; - -VARYING vec4 pos; -VARYING float target_pos_x; -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 sampler2D cloud_noise_texture_next; -uniform float blend_factor; -uniform vec4 cloud_pos_density1; -uniform vec4 cloud_pos_density2; -uniform vec4 sunlight_color; -uniform vec4 cloud_color; -uniform float cloud_shadow; -uniform float cloud_scale; -uniform float cloud_variance; -uniform vec3 camPosLocal; -uniform vec3 sun_dir; -uniform float sun_size; -uniform float far_z; - -#if !defined(DEPTH_CLAMP) -VARYING vec4 post_pos; -#endif - -vec4 cloudNoise(vec2 uv) -{ -   vec4 a = texture2D(cloud_noise_texture, uv); -   vec4 b = texture2D(cloud_noise_texture_next, uv); -   vec4 cloud_noise_sample = mix(a, b, blend_factor); -   return normalize(cloud_noise_sample); -} - -void main() -{ -    if (cloud_scale >= 0.0001) -    { -        // Set variables -        vec2 uv1 = vary_texcoord0.xy; -        vec2 uv2 = vary_texcoord1.xy; -        vec2 uv3 = vary_texcoord2.xy; -        float cloudDensity = 2.0 * (cloud_shadow - 0.25); -     -        vec2 uv4 = vary_texcoord3.xy; -     -        vec2 disturbance  = vec2(cloudNoise(uv1 / 8.0f).x, cloudNoise((uv3 + uv1) / 16.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); -        vec2 disturbance2 = vec2(cloudNoise((uv1 + uv3) / 4.0f).x, cloudNoise((uv4 + uv2) / 8.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); -     -        // Offset texture coords -        uv1 += cloud_pos_density1.xy + (disturbance * 0.2);    //large texture, visible density -        uv2 += cloud_pos_density1.xy;   //large texture, self shadow -        uv3 += cloud_pos_density2.xy;   //small texture, visible density -        uv4 += cloud_pos_density2.xy;   //small texture, self shadow -     -        float density_variance = min(1.0, (disturbance.x* 2.0 + disturbance.y* 2.0 + disturbance2.x + disturbance2.y) * 4.0); -     -        cloudDensity *= 1.0 - (density_variance * density_variance); -     -        // Compute alpha1, the main cloud opacity -        float alpha1 = (cloudNoise(uv1).x - 0.5) + (cloudNoise(uv3).x - 0.5) * cloud_pos_density2.z; -        alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10 * cloud_pos_density1.z, 1.); -     -        // And smooth -        alpha1 = 1. - alpha1 * alpha1; -        alpha1 = 1. - alpha1 * alpha1;   -     -        if (alpha1 < 0.001f) -        { -            discard; -        } -     -        // Compute alpha2, for self shadowing effect -        // (1 - alpha2) will later be used as percentage of incoming sunlight -        float alpha2 = (cloudNoise(uv2).x - 0.5); -        alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); -     -        // And smooth -        alpha2 = 1. - alpha2; -        alpha2 = 1. - alpha2 * alpha2;   -     -        frag_color = vec4(alpha1, alpha1, alpha1, 1); -    } -    else -    { -        frag_color = vec4(1); -    } - -#if !defined(DEPTH_CLAMP) -    gl_FragDepth = max(post_pos.z/post_pos.w*0.5+0.5, 0.0); -#endif - -} diff --git a/indra/newview/app_settings/shaders/class1/windlight/cloudShadowV.glsl b/indra/newview/app_settings/shaders/class1/windlight/cloudShadowV.glsl deleted file mode 100644 index 09b6004481..0000000000 --- a/indra/newview/app_settings/shaders/class1/windlight/cloudShadowV.glsl +++ /dev/null @@ -1,61 +0,0 @@ -/**  - * @file class1\windlight\cloudShadowV.glsl - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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$ - */ - -uniform mat4 texture_matrix0; -uniform mat4 modelview_projection_matrix; -uniform float shadow_target_width; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; -ATTRIBUTE vec2 texcoord0; - -#if !defined(DEPTH_CLAMP) -VARYING float pos_zd2; -#endif - -VARYING vec4 pos; -VARYING float target_pos_x; -VARYING vec2 vary_texcoord0; - -void passTextureIndex(); - -void main() -{ -	//transform vertex -	vec4 pre_pos = vec4(position.xyz, 1.0); -	pos = modelview_projection_matrix * pre_pos; -	target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; - -#if !defined(DEPTH_CLAMP) -	pos_zd2 = pos.z * 0.5; -	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -#else -	gl_Position = pos; -#endif -	 -	passTextureIndex(); - -	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; -} diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl index 2425a2ad04..2e0932343b 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl @@ -52,6 +52,12 @@ void main()          fade = clamp( moon_dir.z*moon_dir.z*4.0, 0.0, 1.0 );      vec4 c     = texture2D(diffuseMap, vary_texcoord0.xy); + +    // SL-14113 Don't write to depth; prevent moon's quad from hiding stars which should be visible +    // Moon texture has transparent pixels <0x55,0x55,0x55,0x00> +    if (c.a <= 2./255.) // 0.00784 +        discard; +  //       c.rgb = pow(c.rgb, vec3(0.7f)); // can't use "srgb_to_linear(color.rgb)" as that is a deferred only function           c.rgb *= moonlight_color.rgb;           c.rgb *= moon_brightness; @@ -62,5 +68,6 @@ void main()           c.rgb  = scaleSoftClip(c.rgb);      frag_color = vec4(c.rgb, c.a); +    gl_FragDepth = LL_SHADER_CONST_CLOUD_MOON_DEPTH; // SL-14113  } | 
