diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
13 files changed, 82 insertions, 26 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 495ed33e9e..97767964f0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -63,7 +63,7 @@ uniform vec3 light_diffuse[8];  vec3 calcDirectionalLight(vec3 n, vec3 l)  { -        float a = pow(max(dot(n,l),0.0), 0.7); +	float a = max(dot(n,l),0.0);  	return vec3(a,a,a);  } @@ -91,7 +91,7 @@ vec3 calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float  		da *= spot*spot; // GL_SPOT_EXPONENT=2  		//angular attenuation -		da *= max(pow(dot(n, lv), 0.7), 0.0);		 +		da *= max(dot(n, lv), 0.0);		  	}  	return vec3(da,da,da);	 diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl index 6aa4d7b4ed..ed02c4a481 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -42,7 +42,7 @@ void main()  	float shadow = 1.0;  	vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; -	 +	color.rgb = pow(color.rgb, vec3(2.2));  	color.rgb = fullbrightAtmosTransport(color.rgb);  	color.rgb = fullbrightScaleSoftClip(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 36433a5827..b91aaf80fb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -43,7 +43,7 @@ void main()  	float shadow = 1.0;  	vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; -	 +	color.rgb = pow(color.rgb, vec3(2.2));  	color.rgb = fullbrightAtmosTransport(color.rgb);  	color.rgb = fullbrightScaleSoftClip(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 9674d9e88e..5e75cc3ce6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -115,7 +115,7 @@ uniform vec3 light_diffuse[8];  vec3 calcDirectionalLight(vec3 n, vec3 l)  { -	float a = pow(max(dot(n,l),0.0), 0.7); +	float a = max(dot(n,l),0.0);  	return vec3(a,a,a);  } @@ -149,8 +149,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe  		da *= max(dot(n, lv), 0.0);		  		float lit = max(da * dist_atten, 0.0); -	 -		lit = pow(lit, 0.7);  		col = light_col*lit*diffuse; @@ -435,6 +433,10 @@ void main()  	}  #endif +#if DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND +	diffcol.rgb = pow(diffcol.rgb, vec3(2.2)); +#endif +  #if HAS_SPECULAR_MAP  	vec4 spec = texture2D(specularMap, vary_texcoord2.xy);  #else diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 3bd433c283..db42a54e42 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -125,11 +125,11 @@ void main()  			float fa = light_col[i].a+1.0;  			float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); -			dist_atten *= noise; +			dist_atten = pow(dist_atten, 2.2) * 2.2; -			float lit = pow(da, 0.7) * dist_atten; +			dist_atten *= noise; -			 +			float lit = da * dist_atten;  			vec3 col = light_col[i].rgb*lit*diff; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 959a85330e..9e8f2f16f9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -169,6 +169,7 @@ void main()  	float fa = falloff+1.0;  	float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); +	dist_atten = pow(dist_atten, 2.2) * 2.2;  	if (dist_atten <= 0.0)  	{  		discard; @@ -201,7 +202,7 @@ void main()  			vec3 lcol = color.rgb * plcol.rgb * plcol.a; -			lit = pow(da, 0.7) * dist_atten * noise; +			lit = da * dist_atten * noise;  			col = lcol*lit*diff_tex;  			amb_da += (da*0.5)*proj_ambiance; @@ -221,6 +222,7 @@ void main()  	vec4 spec = texture2DRect(specularRect, frag.xy); +	  	if (spec.a > 0.0)  	{  		vec3 ref = reflect(normalize(pos), norm); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 6976fc7bd9..36406cbf57 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -111,8 +111,9 @@ void main()  	vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;  	float fa = falloff+1.0;  	float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); -	float lit = pow(da, 0.7) * dist_atten * noise; -	 +	dist_atten = pow(dist_atten, 2.2) * 2.2; +	float lit = da * dist_atten * noise; +  	col = color.rgb*lit*col;  	vec4 spec = texture2DRect(specularRect, frag.xy); diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl new file mode 100644 index 0000000000..2d6bce02c9 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -0,0 +1,46 @@ +/**  + * @file postDeferredGammaCorrect.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$ + */ +  +#extension GL_ARB_texture_rectangle : enable + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +uniform sampler2DRect diffuseRect; + +uniform vec2 screen_res; +VARYING vec2 vary_fragcoord; + +uniform float texture_gamma; + +void main()  +{ +	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord); +	frag_color = pow(diff, vec4(texture_gamma, texture_gamma, texture_gamma, 1.0)); +} + diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index d04d9314ef..aafa932b8f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -60,6 +60,7 @@ uniform float density_multiplier;  uniform float distance_multiplier;  uniform float max_y;  uniform vec4 glow; +uniform float global_gamma;  uniform float scene_light_strength;  uniform mat3 env_mat;  uniform mat3 ssao_effect_mat; @@ -230,9 +231,9 @@ void calcAtmospherics(vec3 inPositionEye, float ambFactor) {  		  + tmpAmbient)));  	//brightness of surface both sunlight and ambient -	setSunlitColor(vec3(sunlight * .5)); -	setAmblitColor(vec3(tmpAmbient * .25)); -	setAdditiveColor(getAdditiveColor() * vec3(1.0 - temp1)); +	setSunlitColor(pow(vec3(sunlight * .5), vec3(global_gamma)) * 3.3); +	setAmblitColor(pow(vec3(tmpAmbient * .25), vec3(global_gamma)) * 3.3); +	setAdditiveColor(pow(getAdditiveColor() * vec3(1.0 - temp1), vec3(global_gamma)) * 3.3);  }  vec3 atmosLighting(vec3 light) @@ -291,12 +292,9 @@ void main()  	norm.xyz = decode_normal(norm.xy); // unpack norm  	float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); -	 -	da = pow(da, 0.7);  	vec4 diffuse = texture2DRect(diffuseRect, tc);  	vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); -	  	vec3 col;  	float bloom = 0.0;  	if (diffuse.a < 0.9) @@ -327,7 +325,7 @@ void main()  		if (envIntensity > 0.0)  		{ //add environmentmap  			vec3 env_vec = env_mat * refnormpersp; -			col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb,  +			col = mix(col.rgb, pow(textureCube(environmentMap, env_vec).rgb, vec3(2.2)) * 2.2,   				max(envIntensity-diffuse.a*2.0, 0.0));   		} diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl index c6031fc45a..b59fcbe017 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl @@ -35,6 +35,6 @@ 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;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 918cdce040..56c10e25cc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -84,6 +84,7 @@ vec3 decode_normal (vec2 enc)  vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)  {  	vec4 ret = texture2DLod(projectionMap, tc, lod); +	ret.rgb = pow(ret.rgb, vec3(2.2));  	vec2 dist = tc-vec2(0.5); @@ -99,7 +100,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)  vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)  {  	vec4 ret = texture2DLod(projectionMap, tc, lod); -	 +	ret.rgb = pow(ret.rgb, vec3(2.2)); +  	vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));  	float det = min(lod/(proj_lod*0.5), 1.0); @@ -116,7 +118,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)  vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)  {  	vec4 ret = texture2DLod(projectionMap, tc, lod); -	 +	ret.rgb = pow(ret.rgb, vec3(2.2)); +  	vec2 dist = tc-vec2(0.5);  	float d = dot(dist,dist); @@ -172,6 +175,7 @@ void main()  	float fa = falloff+1.0;  	float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); +	dist_atten = pow(dist_atten, 2.2) * 2.2;  	if (dist_atten <= 0.0)  	{  		discard; @@ -204,7 +208,7 @@ void main()  			vec3 lcol = color.rgb * plcol.rgb * plcol.a; -			lit = pow(da, 0.7) * dist_atten * noise; +			lit = da * dist_atten * noise;  			col = lcol*lit*diff_tex;  			amb_da += (da*0.5)*proj_ambiance; @@ -224,6 +228,7 @@ void main()  	vec4 spec = texture2DRect(specularRect, frag.xy); +  	if (spec.a > 0.0)  	{  		vec3 ref = reflect(normalize(pos), norm); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl index 6c34643aab..e130ef5d91 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl @@ -30,6 +30,7 @@ out vec4 frag_color;  #endif  uniform float minimum_alpha; +uniform float texture_gamma;  vec3 fullbrightAtmosTransport(vec3 light);  vec3 fullbrightScaleSoftClip(vec3 light); @@ -45,7 +46,7 @@ void fullbright_lighting()  	{  		discard;  	} - +	color.rgb = pow(color.rgb, vec3(texture_gamma));  	color.rgb = fullbrightAtmosTransport(color.rgb);  	color.rgb = fullbrightScaleSoftClip(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl index f4477bd29a..56ad658696 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl @@ -30,6 +30,7 @@ out vec4 frag_color;  #endif  uniform float minimum_alpha; +uniform float texture_gamma;  vec3 fullbrightAtmosTransport(vec3 light);  vec3 fullbrightScaleSoftClip(vec3 light); @@ -47,7 +48,7 @@ void fullbright_lighting()  	{  		discard;  	} - +	color.rgb = pow(color.rgb, vec3(texture_gamma));  	color.rgb = fullbrightAtmosTransport(color.rgb);  	color.rgb = fullbrightScaleSoftClip(color.rgb); | 
