diff options
Diffstat (limited to 'indra/newview/app_settings')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl | 17 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl | 4 |
2 files changed, 15 insertions, 6 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index 3cfad5498b..ae6bdbba95 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -105,11 +105,11 @@ vec3 toneMapACES_Hill(vec3 color) uniform float exposure; uniform float gamma; -vec3 toneMap(vec3 color) +vec3 toneMap(vec3 color, float gs) { float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r; - color *= exposure * exp_scale; + color *= exposure * exp_scale * gs; #ifdef TONEMAP_ACES_NARKOWICZ color = toneMapACES_Narkowicz(color); @@ -179,12 +179,21 @@ vec3 legacyGamma(vec3 color) return color; } +float legacyGammaApprox() +{ + //TODO -- figure out how to plumb this in as a uniform + float c = 0.5; + float gc = 1.0-pow(c, gamma); + + return gc/c * gamma; +} + void main() { //this is the one of the rare spots where diffuseRect contains linear color values (not sRGB) vec4 diff = texture2D(diffuseRect, vary_fragcoord); - diff.rgb = toneMap(diff.rgb); - diff.rgb = legacyGamma(diff.rgb); + + diff.rgb = toneMap(diff.rgb, legacyGammaApprox()); vec2 tc = vary_fragcoord.xy*screen_res*4.0; vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl index 12a99edc34..7f6827b160 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl @@ -141,7 +141,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou // fudge sunlit and amblit to get consistent lighting compared to legacy // midday before PBR was a thing - sunlit = sunlight.rgb; + sunlit = sunlight.rgb * (1.0+sun_up_factor*0.3); amblit = tmpAmbient.rgb * 0.25; additive *= vec3(1.0 - combined_haze); @@ -172,7 +172,7 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou sunlit *= 2.0; // squash ambient to approximate whatever weirdness legacy atmospherics were doing - amblit = ambient_color * 0.5; + amblit = ambient_color * 0.5 * (1.0+sun_up_factor*0.3); amblit *= ambientLighting(norm, light_dir); amblit = srgb_to_linear(amblit); |