diff options
Diffstat (limited to 'indra/newview/app_settings/shaders')
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl | 13 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl | 16 | 
2 files changed, 22 insertions, 7 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 9e194cdcd1..ad50690c02 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -123,13 +123,20 @@ void main()  			if (spec.a > 0.0)  			{  				//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; +				vec3 fres = spec.rgb + pow(1 - dot(h, npos), 5) * (1 - spec.rgb); +				float gtdenom = 2 * nh; +				float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); -				float sa = dot(normalize(lv+npos),norm);  				if (sa > 0.0)  				{ -					sa = texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0); -					col += da*sa*light_col[i].rgb*spec.rgb; +					vec3 scol = (fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt) / (nh * da); +					col += lit*scol*light_col[i].rgb;  				}  			} diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index fa1572e692..03b036375b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -107,12 +107,20 @@ void main()  	vec4 spec = texture2DRect(specularRect, frag.xy);  	if (spec.a > 0.0)  	{ -		float sa = dot(normalize(lv-normalize(pos)),norm); -		spec.rgb += pow(1 - dot(-normalize(pos), norm), 2) * da * 3; +		vec3 npos = -normalize(pos); +		vec3 h = normalize(lv+npos); +		float nh = dot(norm, h); +		float nv = dot(norm, npos); +		float vh = dot(npos, h); +		float sa = nh; +		vec3 fres = spec.rgb + pow(1 - dot(h, npos), 5) * (1 - spec.rgb); +		float gtdenom = 2 * nh; +		float gt = max(0,(min(gtdenom * nv / vh, gtdenom * da / vh))); +  		if (sa > 0.0)  		{ -			sa = texture2D(lightFunc, vec2(sa, spec.a)).r * min(dist_atten*4.0, 1.0); -			col += da*sa*color.rgb*spec.rgb; +			vec3 scol = (fres * texture2D(lightFunc, vec2(nh, spec.a)).r * gt) / (nh * da); +			col += lit*scol*color.rgb;  		}  	}  | 
