diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
7 files changed, 48 insertions, 45 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 54ec534d14..bcce4c041a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -72,20 +72,12 @@ uniform vec2 screen_res;  uniform mat4 inv_proj;  vec3 srgb_to_linear(vec3 cs); -vec3 linear_to_srgb(vec3 cl); -  vec3 getNorm(vec2 pos_screen); - -vec4 correctWithGamma(vec4 col) -{ -	return vec4(srgb_to_linear(col.rgb), col.a); -} -  vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)  {      vec4 ret = texture2DLod(projectionMap, tc, lod); -    ret = correctWithGamma(ret); +    ret.rgb = srgb_to_linear(ret.rgb);      vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));      float det = min(lod/(proj_lod*0.5), 1.0); @@ -104,7 +96,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)  vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)  {      vec4 ret = texture2DLod(projectionMap, tc, lod); -    ret = correctWithGamma(ret); +    ret.rgb = srgb_to_linear(ret.rgb);      vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -122,7 +114,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)  vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)  {      vec4 ret = texture2DLod(projectionMap, tc, lod); -    ret = correctWithGamma(ret); +    ret.rgb = srgb_to_linear(ret.rgb);      vec2 dist = tc-vec2(0.5); @@ -137,6 +129,12 @@ vec4 getPosition(vec2 pos_screen);  void main()   { + +    vec3 col = vec3(0,0,0); + +#if defined(LOCAL_LIGHT_KILL) +    discard; +#else      vec4 frag = vary_fragcoord;      frag.xyz /= frag.w;      frag.xyz = frag.xyz*0.5+0.5; @@ -191,8 +189,6 @@ void main()      lv = proj_origin-pos.xyz;      lv = normalize(lv);      float da = dot(norm, lv); - -    vec3 col = vec3(0,0,0);      vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; @@ -292,6 +288,7 @@ void main()              }          }      } +#endif      //not sure why, but this line prevents MATBUG-194      col = max(col, vec3(0.0)); diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl index eb95890e08..dca2862b5a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl @@ -88,6 +88,7 @@ vec3 halo22(float d)  /// Soft clips the light with a gamma correction  vec3 scaleSoftClip(vec3 light); +vec3 srgb_to_linear(vec3 c);  void main()  { @@ -194,10 +195,12 @@ void main()      color.rgb += halo_22; -    color *= 2.; +    color.rgb *= 2.; +    color.rgb = scaleSoftClip(color.rgb); +    color.rgb = srgb_to_linear(color.rgb);      /// Gamma correct for WL (soft clip effect). -    frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0); +    frag_data[0] = vec4(color.rgb, 1.0);      frag_data[1] = vec4(0.0,0.0,0.0,0.0);      frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog  } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 1b2b835ad1..7f83e168bb 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -24,6 +24,7 @@   */  #extension GL_ARB_texture_rectangle : enable +#extension GL_ARB_shader_texture_lod : enable  /*[EXTRA_CODE_HERE]*/ @@ -87,14 +88,11 @@ void main()      float da = dot(normalize(norm.xyz), light_dir.xyz);            da = clamp(da, -1.0, 1.0); -     -      float final_da = da;            final_da = clamp(final_da, 0.0, 1.0); -    vec4 diffuse_srgb   = texture2DRect(diffuseRect, tc); -    vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); -  +    vec4 diffuse_linear = texture2DRect(diffuseRect, tc); +    vec4 diffuse_srgb   = vec4(linear_to_srgb(diffuse_linear.rgb), diffuse_linear.a);      // clamping to alpha value kills underwater shadows...      //scol = max(scol_ambocc.r, diffuse_linear.a); @@ -116,20 +114,27 @@ void main()          float ambient = da;          ambient *= 0.5;          ambient *= ambient; -        ambient = min(getAmbientClamp(), 1.0 - ambient); + +        float ambient_clamp = getAmbientClamp() + 0.1; +        ambient = (1.0 - ambient); +        ambient *= ambient_clamp;          vec3 sun_contrib = min(scol, final_da) * sunlit; +#if !defined(AMBIENT_KILL)          color.rgb = amblit;          color.rgb *= ambient; +#endif  vec3 post_ambient = color.rgb; +#if !defined(SUNLIGHT_KILL)          color.rgb += sun_contrib; +#endif  vec3 post_sunlight = color.rgb; -        color.rgb *= diffuse_srgb.rgb; +        color.rgb *= diffuse_linear.rgb;  vec3 post_diffuse = color.rgb; @@ -155,7 +160,7 @@ vec3 post_diffuse = color.rgb;                  float scontrib = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da);                  vec3 sp = sun_contrib*scontrib / 16.0;                  sp = clamp(sp, vec3(0), vec3(1)); -                bloom += dot (sp, sp) / 6.0; +                bloom += dot(sp, sp) / 6.0;                  color += sp * spec.rgb;              }          } @@ -163,7 +168,7 @@ vec3 post_diffuse = color.rgb;   vec3 post_spec = color.rgb;  #ifndef WATER_FOG -        color.rgb += diffuse_srgb.a * diffuse_srgb.rgb; +        color.rgb = mix(color.rgb, diffuse_srgb.rgb, diffuse_srgb.a);  #endif          if (envIntensity > 0.0) diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 2ef7cffe9d..77f6e6f7ac 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -73,15 +73,11 @@ uniform mat4 inv_proj;  vec3 getNorm(vec2 pos_screen);  vec3 srgb_to_linear(vec3 c); -vec4 correctWithGamma(vec4 col) -{ -	return vec4(srgb_to_linear(col.rgb), col.a); -}  vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)  {  	vec4 ret = texture2DLod(projectionMap, tc, lod); -	ret = correctWithGamma(ret); +	ret.rgb = srgb_to_linear(ret.rgb);  	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -101,7 +97,7 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)  vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)  {  	vec4 ret = texture2DLod(projectionMap, tc, lod); -	ret = correctWithGamma(ret); +	ret.rgb = srgb_to_linear(ret.rgb);  	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -119,7 +115,7 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)  vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)  {  	vec4 ret = texture2DLod(projectionMap, tc, lod); -	ret = correctWithGamma(ret); +	ret.rgb = srgb_to_linear(ret.rgb);  	vec2 dist = tc-vec2(0.5); @@ -134,6 +130,11 @@ vec4 getPosition(vec2 pos_screen);  void main()   { +	vec3 col = vec3(0,0,0); + +#if defined(LOCAL_LIGHT_KILL) +    discard; +#else  	vec4 frag = vary_fragcoord;  	frag.xyz /= frag.w;  	frag.xyz = frag.xyz*0.5+0.5; @@ -174,8 +175,8 @@ void main()  	proj_tc.xyz /= proj_tc.w; -	float fa = falloff + 1.0; -	float dist_atten = min(1.0 - (dist - 1.0 * (1.0 - fa)) / fa, 1.0); +	float fa = falloff+1.0; +	float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0);  	dist_atten *= dist_atten;  	dist_atten *= 2.0; @@ -187,14 +188,9 @@ void main()  	lv = proj_origin-pos.xyz;  	lv = normalize(lv);  	float da = dot(norm, lv); -	      da = clamp(da, 0.0, 1.0); -	 -	vec3 col = vec3(0,0,0);  	vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; -		  	vec4 spec = texture2DRect(specularRect, frag.xy); -  	vec3 dlit = vec3(0, 0, 0);  	float noise = texture2D(noiseMap, frag.xy/128.0).b; @@ -232,7 +228,6 @@ void main()  	    col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;  	} -	  	if (spec.a > 0.0)  	{ @@ -258,10 +253,6 @@ void main()  			col += speccol;  		}  	}	 -	 -	 -	 -	  	if (envIntensity > 0.0)  	{ @@ -291,6 +282,7 @@ void main()  			}  		}  	} +#endif  	//not sure why, but this line prevents MATBUG-194  	col = max(col, vec3(0.0)); diff --git a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl index 57f93a8b36..8795d69a3a 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/sumLightsV.glsl @@ -44,9 +44,16 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color)  	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);  	col.rgb = scaleDownLight(col.rgb); +#if defined(LOCAL_LIGHT_KILL) +    col.rgb = vec3(0); +i#endif +  	// Add windlight lights  	col.rgb += atmosAffectDirectionalLight(calcDirectionalLight(norm, light_position[0].xyz)); +#if !defined(SUNLIGHT_KILL)  	col.rgb = min(col.rgb*color.rgb, 1.0); +#endif +  	return col;	  } diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl index 28d185b9af..02e10b7b50 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl @@ -50,7 +50,6 @@ void main()  	vec4 color;  	color = vary_HazeColor;  	color *= 2.; -  	/// Gamma correct for WL (soft clip effect).  	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 a23a5d4076..5b1eb55e0c 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl @@ -88,7 +88,7 @@ void main()  	vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;  	vec4 light_atten; -    float dens_mul = density_multiplier * 0.45; +    float dens_mul = density_multiplier;  	// Sunlight attenuation effect (hue and brightness) due to atmosphere  	// this is used later for sunlight modulation at various altitudes  | 
