diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred')
| -rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 59 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl | 60 | 
2 files changed, 73 insertions, 46 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 66a1a8515f..f0c9b01671 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -267,34 +267,49 @@ void main()  	float da = max(dot(norm.xyz, vary_light.xyz), 0.0);  	vec4 diffuse = texture2DRect(diffuseRect, tc); -	vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); -	 -	vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; -	float scol = max(scol_ambocc.r, diffuse.a);  -	float ambocc = scol_ambocc.g; + +	vec3 col; +	float bloom = 0.0; + +	if (diffuse.a < 0.9) +	{ +		vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); +		 +		vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; +		float scol = max(scol_ambocc.r, diffuse.a);  +		float ambocc = scol_ambocc.g; -	calcAtmospherics(pos.xyz, ambocc); +		calcAtmospherics(pos.xyz, ambocc); -	vec3 col = atmosAmbient(vec3(0)); -	col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)); +		col = atmosAmbient(vec3(0)); +		col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)); -	col *= diffuse.rgb; +		col *= diffuse.rgb; -	if (spec.a > 0.0) // specular reflection +		if (spec.a > 0.0) // specular reflection +		{ +			// the old infinite-sky shiny reflection +			// +			vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); +			float sa = dot(refnormpersp, vary_light.xyz); +			vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; + +			// add the two types of shiny together +			vec3 spec_contrib = dumbshiny * spec.rgb; +			bloom = dot(spec_contrib, spec_contrib); +			col += spec_contrib; +		} +			 +		col = atmosLighting(col); +		col = scaleSoftClip(col); + +		col = mix(col, diffuse.rgb, diffuse.a); +	} +	else  	{ -		// the old infinite-sky shiny reflection -		// -		vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); -		float sa = dot(refnormpersp, vary_light.xyz); -		vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; - -		// add the two types of shiny together -		col += dumbshiny * spec.rgb; +		col = diffuse.rgb;  	} -	 -	col = atmosLighting(col); -	col = scaleSoftClip(col);  	gl_FragColor.rgb = col; -	gl_FragColor.a = 0.0; +	gl_FragColor.a = bloom;  } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl index 0bae10ca7d..3b572320c3 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl @@ -255,7 +255,7 @@ void main()  	vec2 tc = vary_fragcoord.xy;  	ivec2 itc = ivec2(tc); -	vec3 fcol = vec3(0,0,0); +	vec4 fcol = vec4(0,0,0,0);  	vec2 scol_ambocc = texture2DRect(lightMap, tc).rg;  	float ambocc = scol_ambocc.g; @@ -270,38 +270,50 @@ void main()  		float da = max(dot(norm.xyz, vary_light.xyz), 0.0);  		vec4 diffuse = texelFetch(diffuseRect, itc, i); -		vec4 spec = texelFetch(specularRect, itc, i); +		vec3 col; +		float bloom = 0.0; +		if (diffuse.a < 0.9) +		{ +			vec4 spec = texelFetch(specularRect, itc, i); -		float amb = 0; +			float amb = 0; -		float scol = max(scol_ambocc.r, diffuse.a);  -		amb += ambocc; +			float scol = max(scol_ambocc.r, diffuse.a);  +			amb += ambocc; -		calcAtmospherics(pos.xyz, ambocc); +			calcAtmospherics(pos.xyz, ambocc); +	 +			col = atmosAmbient(vec3(0)); +			col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)); -		vec3 col = atmosAmbient(vec3(0)); -		col += atmosAffectDirectionalLight(max(min(da, scol), diffuse.a)); +			col *= diffuse.rgb; -		col *= diffuse.rgb; +			if (spec.a > 0.0) // specular reflection +			{ +				// the old infinite-sky shiny reflection +				// +				vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); +				float sa = dot(refnormpersp, vary_light.xyz); +				vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; + +				// add the two types of shiny together +				vec3 spec_contrib = dumbshiny * spec.rgb; +				bloom = dot(spec_contrib, spec_contrib); +				col += spec_contrib; +			} -		if (spec.a > 0.0) // specular reflection +			col = atmosLighting(col); +			col = scaleSoftClip(col); + +			col = mix(col, diffuse.rgb, diffuse.a); +		} +		else  		{ -			// the old infinite-sky shiny reflection -			// -			vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); -			float sa = dot(refnormpersp, vary_light.xyz); -			vec3 dumbshiny = vary_SunlitColor*scol_ambocc.r*texture2D(lightFunc, vec2(sa, spec.a)).a; - -			// add the two types of shiny together -			col += dumbshiny * spec.rgb; +			col = diffuse.rgb;  		} -	 -		col = atmosLighting(col); -		col = scaleSoftClip(col); -		fcol += col; +		fcol += vec4(col, bloom);  	} -	gl_FragColor.rgb = fcol/samples;  -	gl_FragColor.a = 0.0; +	gl_FragColor = fcol/samples;   }  | 
