diff options
author | Graham Linden <graham@lindenlab.com> | 2019-02-22 14:50:03 -0800 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-02-22 14:50:03 -0800 |
commit | 4aad62006259c20bcdda1495138f7313b8f35e8d (patch) | |
tree | d6a011a2030535cb30c34e0e37f2b552d984ea90 /indra/newview/app_settings/shaders/class2/deferred | |
parent | 9a66e4a9dec4ae6abbd9048c7cacd3480b513cbc (diff) |
SL-10415, SL-10612, SL-10569
Fix shadow sampling min with caster dp and offset tweaks.
Fix moon direction not being transformed as the sun dir is.
Fix colorspace issue causing some objects to render grayish instead of blackish.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred')
-rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 8bc9add5cf..7fd4d7e248 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -90,17 +90,16 @@ void main() vec4 norm = texture2DRect(normalMap, tc); float envIntensity = norm.z; norm.xyz = getNorm(tc); // unpack norm - - float da_sun = dot(norm.xyz, sun_dir.xyz); - float da_moon = dot(norm.xyz, moon_dir.xyz); - float da = (sun_up_factor == 1) ? da_sun : da_moon; - da = clamp(da, 0.0, 1.0); - da = pow(da, global_gamma + 0.3); + vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; + + float da = dot(norm.xyz, light_dir.xyz); + da = clamp(da, 0.0, 1.0); vec4 diffuse = texture2DRect(diffuseRect, tc); vec3 col; + float scol = 1.0; float bloom = 0.0; { vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); @@ -108,9 +107,13 @@ void main() vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; scol_ambocc = pow(scol_ambocc, vec2(global_gamma + 0.3)); - float scol = max(scol_ambocc.r, diffuse.a); + scol = max(scol_ambocc.r, diffuse.a); float ambocc = scol_ambocc.g; + float final_da = da; + final_da = min(final_da, scol); + final_da = pow(final_da, global_gamma + 0.3); + vec3 sunlit; vec3 amblit; vec3 additive; @@ -118,18 +121,17 @@ void main() calcFragAtmospherics(pos.xyz, ambocc, sunlit, amblit, additive, atten); - float ambient = da; - + float ambient = min(da, 1.0); ambient *= 0.5; ambient *= ambient; - ambient = (1.0-ambient); - - col.rgb = amblit; - col.rgb *= min(ambient, max(scol, 0.5)); + ambient = min(1.0 - ambient,max(scol,0.3)); - col += sunlit * da * scol; + vec3 sun_contrib = sunlit * final_da; - col *= diffuse.rgb; + col.rgb = amblit; + col.rgb *= ambient; + col.rgb += sun_contrib; + col.rgb *= diffuse.rgb; vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); @@ -165,9 +167,6 @@ void main() col = fogged.rgb; bloom = fogged.a; #endif - -//col.rgb = vec3(scol); -//col.rgb = vec3(da * scol); } frag_color.rgb = col; frag_color.a = bloom; |