diff options
| author | Dave Parks <davep@lindenlab.com> | 2013-06-26 11:55:03 -0500 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2013-06-26 11:55:03 -0500 | 
| commit | bb66e722d3ebf62145784227178ccdd318189cf6 (patch) | |
| tree | cc28868865089c9a377e4db16f29e09893ed83e8 /indra/newview/app_settings/shaders/class1 | |
| parent | 280a9d9827e4e5e0e1408cc8f9c20ef792a6c714 (diff) | |
| parent | b717a28194eb6e5a2f9113c65abe62cb81141413 (diff) | |
Automated merge with https://bitbucket.org/davep/viewer-release-iqa-1366
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
8 files changed, 38 insertions, 189 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 968a5f6b3d..a4f54dff70 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -59,22 +59,6 @@ vec4 getPosition(vec2 pos_screen)  	return pos;  } -#ifdef SINGLE_FP_ONLY -vec2 encode_normal(vec3 n) -{ -	vec2 sn; -	sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); -	return sn; -} - -vec3 decode_normal (vec2 enc) -{ -	vec3 n; -	n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); -	n.z = sqrt(1.0f - dot(n.xy,n.xy)); -	return n; -} -#else  vec2 encode_normal(vec3 n)  {  	float f = sqrt(8 * n.z + 8); @@ -91,7 +75,6 @@ vec3 decode_normal (vec2 enc)      n.z = 1-f/2;      return n;  } -#endif  void main()   { diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 10b6385809..53ade8ea64 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -428,22 +428,6 @@ VARYING vec3 vary_normal;  VARYING vec4 vertex_color;  VARYING vec2 vary_texcoord0; -#ifdef SINGLE_FP_ONLY -vec2 encode_normal(vec3 n) -{ -	vec2 sn; -	sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); -	return sn; -} - -vec3 decode_normal (vec2 enc) -{ -	vec3 n; -	n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); -	n.z = sqrt(1.0f - dot(n.xy,n.xy)); -	return n; -} -#else  vec2 encode_normal(vec3 n)  {  	float f = sqrt(8 * n.z + 8); @@ -460,7 +444,6 @@ vec3 decode_normal (vec2 enc)      n.z = 1-f/2;      return n;  } -#endif  void main()   { diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 868526d457..a955ef6e9d 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -45,9 +45,8 @@ uniform float sun_wash;  uniform int light_count; -#define MAX_LIGHT_COUNT		16 -uniform vec4 light[MAX_LIGHT_COUNT]; -uniform vec4 light_col[MAX_LIGHT_COUNT]; +uniform vec4 light[LIGHT_COUNT]; +uniform vec4 light_col[LIGHT_COUNT];  VARYING vec4 vary_fragcoord;  uniform vec2 screen_res; @@ -56,22 +55,6 @@ uniform float far_z;  uniform mat4 inv_proj; -#ifdef SINGLE_FP_ONLY -vec2 encode_normal(vec3 n) -{ -	vec2 sn; -	sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); -	return sn; -} - -vec3 decode_normal (vec2 enc) -{ -	vec3 n; -	n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); -	n.z = sqrt(1.0f - dot(n.xy,n.xy)); -	return n; -} -#else  vec2 encode_normal(vec3 n)  {  	float f = sqrt(8 * n.z + 8); @@ -88,7 +71,6 @@ vec3 decode_normal (vec2 enc)      n.z = 1-f/2;      return n;  } -#endif  vec4 getPosition(vec2 pos_screen)  { @@ -122,73 +104,59 @@ void main()  	vec3 npos = normalize(-pos);  	// As of OSX 10.6.7 ATI Apple's crash when using a variable size loop -	for (int i = 0; i < MAX_LIGHT_COUNT; ++i) +	for (int i = 0; i < LIGHT_COUNT; ++i)  	{ -		bool light_contrib = (i < light_count); -		  		vec3 lv = light[i].xyz-pos;  		float dist = length(lv);  		dist /= light[i].w; -		if (dist > 1.0) +		if (dist <= 1.0)  		{ -			light_contrib = false; -		} -		 -		float da = dot(norm, lv); -		if (da < 0.0) -		{ -			light_contrib = false; -		} -		 -		if (light_contrib) -		{ -			lv = normalize(lv); -			da = dot(norm, lv); +			float da = dot(norm, lv); +			if (da > 0.0) +			{ +				lv = normalize(lv); +				da = dot(norm, lv); -			float fa = light_col[i].a+1.0; -			float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); -			dist_atten *= dist_atten; -			dist_atten *= 2.0; +				float fa = light_col[i].a+1.0; +				float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); +				dist_atten *= dist_atten; +				dist_atten *= 2.0; -			dist_atten *= noise; +				dist_atten *= noise; -			float lit = da * dist_atten; +				float lit = da * dist_atten; -			vec3 col = light_col[i].rgb*lit*diff; +				vec3 col = light_col[i].rgb*lit*diff; -			//vec3 col = vec3(dist2, light_col[i].a, lit); +				//vec3 col = vec3(dist2, light_col[i].a, lit); -			if (spec.a > 0.0) -			{ -				lit = min(da*6.0, 1.0) * dist_atten; -				//vec3 ref = dot(pos+lv, norm); -				vec3 h = normalize(lv+npos); -				float nh = dot(norm, h); -				float nv = dot(norm, npos); -				float vh = dot(npos, h); -				float sa = nh; -				float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - -				float gtdenom = 2 * nh; -				float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); -								 -				if (nh > 0.0) +				if (spec.a > 0.0)  				{ -					float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); -					col += lit*scol*light_col[i].rgb*spec.rgb; -					//col += spec.rgb; +					lit = min(da*6.0, 1.0) * dist_atten; +					//vec3 ref = dot(pos+lv, norm); +					vec3 h = normalize(lv+npos); +					float nh = dot(norm, h); +					float nv = dot(norm, npos); +					float vh = dot(npos, h); +					float sa = nh; +					float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; + +					float gtdenom = 2 * nh; +					float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); +								 +					if (nh > 0.0) +					{ +						float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); +						col += lit*scol*light_col[i].rgb*spec.rgb; +						//col += spec.rgb; +					}  				} -			} -			out_col += col; +				out_col += col; +			}  		}  	} -	if (dot(out_col, out_col) <= 0.0) -	{ -		discard; -	} -	  	frag_color.rgb = out_col;  	frag_color.a = 0.0;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index 97bf49a605..7d39ad7bc1 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -67,22 +67,6 @@ uniform vec2 screen_res;  uniform mat4 inv_proj; -#ifdef SINGLE_FP_ONLY -vec2 encode_normal(vec3 n) -{ -	vec2 sn; -	sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); -	return sn; -} - -vec3 decode_normal (vec2 enc) -{ -	vec3 n; -	n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); -	n.z = sqrt(1.0f - dot(n.xy,n.xy)); -	return n; -} -#else  vec2 encode_normal(vec3 n)  {  	float f = sqrt(8 * n.z + 8); @@ -99,7 +83,6 @@ vec3 decode_normal (vec2 enc)      n.z = 1-f/2;      return n;  } -#endif  vec4 correctWithGamma(vec4 col)  { diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index caf20ce707..106d48bd71 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -54,22 +54,6 @@ uniform vec2 screen_res;  uniform mat4 inv_proj;  uniform vec4 viewport; -#ifdef SINGLE_FP_ONLY -vec2 encode_normal(vec3 n) -{ -	vec2 sn; -	sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); -	return sn; -} - -vec3 decode_normal (vec2 enc) -{ -	vec3 n; -	n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); -	n.z = sqrt(1.0f - dot(n.xy,n.xy)); -	return n; -} -#else  vec2 encode_normal(vec3 n)  {  	float f = sqrt(8 * n.z + 8); @@ -86,7 +70,6 @@ vec3 decode_normal (vec2 enc)      n.z = 1-f/2;      return n;  } -#endif  vec4 getPosition(vec2 pos_screen)  { diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 08583ad0f2..f0d2746700 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -78,22 +78,6 @@ vec3 vary_AtmosAttenuation;  uniform mat4 inv_proj;  uniform vec2 screen_res; -#ifdef SINGLE_FP_ONLY -vec2 encode_normal(vec3 n) -{ -	vec2 sn; -	sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); -	return sn; -} - -vec3 decode_normal (vec2 enc) -{ -	vec3 n; -	n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); -	n.z = sqrt(1.0f - dot(n.xy,n.xy)); -	return n; -} -#else  vec3 decode_normal (vec2 enc)  {      vec2 fenc = enc*4-2; @@ -104,7 +88,6 @@ vec3 decode_normal (vec2 enc)      n.z = 1-f/2;      return n;  } -#endif  vec4 getPosition_d(vec2 pos_screen, float depth)  { diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 1975b18652..045d1a00cd 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -65,22 +65,6 @@ uniform vec2 screen_res;  uniform mat4 inv_proj; -#ifdef SINGLE_FP_ONLY -vec2 encode_normal(vec3 n) -{ -	vec2 sn; -	sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); -	return sn; -} - -vec3 decode_normal (vec2 enc) -{ -	vec3 n; -	n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); -	n.z = sqrt(1.0f - dot(n.xy,n.xy)); -	return n; -} -#else  vec2 encode_normal(vec3 n)  {  	float f = sqrt(8 * n.z + 8); @@ -97,7 +81,6 @@ vec3 decode_normal (vec2 enc)      n.z = 1-f/2;      return n;  } -#endif  vec4 correctWithGamma(vec4 col)  { diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index 6653f57ee1..c0a5865bef 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -49,22 +49,6 @@ VARYING vec2 vary_fragcoord;  uniform mat4 inv_proj;  uniform vec2 screen_res; -#ifdef SINGLE_FP_ONLY -vec2 encode_normal(vec3 n) -{ -	vec2 sn; -	sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f); -	return sn; -} - -vec3 decode_normal (vec2 enc) -{ -	vec3 n; -	n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f); -	n.z = sqrt(1.0f - dot(n.xy,n.xy)); -	return n; -} -#else  vec2 encode_normal(vec3 n)  {  	float f = sqrt(8 * n.z + 8); @@ -81,7 +65,6 @@ vec3 decode_normal (vec2 enc)      n.z = 1-f/2;      return n;  } -#endif  vec4 getPosition(vec2 pos_screen)  { | 
