diff options
| author | Runitai Linden <davep@lindenlab.com> | 2020-03-05 16:28:06 -0600 | 
|---|---|---|
| committer | Runitai Linden <davep@lindenlab.com> | 2020-03-05 16:28:06 -0600 | 
| commit | 7c7d71269f5b47397d14bbe44e341e4ac1d96889 (patch) | |
| tree | ea9ff1c27a6e067d225929b2f28d637db32d20bf /indra/newview/app_settings/shaders/class2 | |
| parent | 90ad38db065877be16371e7814a39618135a30ab (diff) | |
WIP - Windlight sun lighting should happen in sRGB space, not linear space.  This keeps ambient from getting overblown and better matches environment lighting with ALM on/off.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
3 files changed, 10 insertions, 7 deletions
| diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 7cde67d11b..5d7a28c359 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -192,8 +192,9 @@ void main()      vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;      // SL-12005 Projector light pops as we get closer, more objectionable than being in wrong color space. -    //          We can't switch to linear here unless we do it everywhere -    //diff_tex.rgb = srgb_to_linear(diff_tex.rgb); +    //          We can't switch to linear here unless we do it everywhere* +    // *gbuffer IS sRGB, convert to linear since this shader outputs linear +    diff_tex.rgb = srgb_to_linear(diff_tex.rgb);      vec4 spec = texture2DRect(specularRect, frag.xy); @@ -296,6 +297,7 @@ void main()      //not sure why, but this line prevents MATBUG-194      col = max(col, vec3(0.0)); -    frag_color.rgb = col;    +    //output linear +    frag_color.rgb = col;      frag_color.a = 0.0;  } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index bacdb6f70f..58d573c724 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -106,7 +106,7 @@ void main()          vec3 atten;          calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, true); - +                  float ambient = da;          ambient *= 0.5;          ambient *= ambient; @@ -127,7 +127,7 @@ vec3 post_ambient = color.rgb;  vec3 post_sunlight = color.rgb; -        color.rgb *= diffuse_linear.rgb; +        color.rgb *= diffuse_srgb.rgb;  vec3 post_diffuse = color.rgb; @@ -218,6 +218,6 @@ vec3 post_atmo = color.rgb;          //output linear RGB as lights are summed up in linear space and then gamma corrected prior to the           //post deferred passes -    frag_color.rgb = color.rgb; +    frag_color.rgb = srgb_to_linear(color.rgb);      frag_color.a = bloom;  } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 77f6e6f7ac..5ab0b5c5b4 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -189,7 +189,7 @@ void main()  	lv = normalize(lv);  	float da = dot(norm, lv); -	vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; +	vec3 diff_tex = srgb_to_linear(texture2DRect(diffuseRect, frag.xy).rgb);  	vec4 spec = texture2DRect(specularRect, frag.xy);  	vec3 dlit = vec3(0, 0, 0); @@ -287,6 +287,7 @@ void main()  	//not sure why, but this line prevents MATBUG-194  	col = max(col, vec3(0.0)); +	//output linear colors as gamma correction happens down stream  	frag_color.rgb = col;	  	frag_color.a = 0.0;  } | 
