diff options
author | Geenz <geenz@geenzo.com> | 2013-01-11 06:37:21 -0500 |
---|---|---|
committer | Geenz <geenz@geenzo.com> | 2013-01-11 06:37:21 -0500 |
commit | eda11a25a465dd87b187f63da661f2ce02925deb (patch) | |
tree | e77e33b4ee7b6f18f314576948be1560c3640ce9 /indra/newview/app_settings/shaders/class2 | |
parent | e8f6734d67ce1f61c5745bc1b25a9e5d1d599aca (diff) |
Initial (largely complete) gamma correct rendering implementation.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
4 files changed, 17 insertions, 9 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 12706f130b..359864556d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -149,6 +149,7 @@ void main() } vec4 diff = diffuseLookup(vary_texcoord0.xy); + diff.rgb = pow(diff.rgb, vec3(2.2)); vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, vertex_color.a); vec4 color = diff * col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 457189b48e..bf4c476138 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -79,6 +79,11 @@ vec3 vary_AmblitColor; vec3 vary_AdditiveColor; vec3 vary_AtmosAttenuation; +vec3 samplesRGB(vec3 color) +{ + return pow(color, vec3(2.2)); +} + vec4 getPosition_d(vec2 pos_screen, float depth) { vec2 sc = pos_screen.xy*2.0; @@ -103,15 +108,15 @@ vec3 getPositionEye() } vec3 getSunlitColor() { - return vary_SunlitColor; + return samplesRGB(vary_SunlitColor) * 4.4; } vec3 getAmblitColor() { - return vary_AmblitColor; + return samplesRGB(vary_AmblitColor) * 2.2; } vec3 getAdditiveColor() { - return vary_AdditiveColor; + return samplesRGB(vary_AdditiveColor) * 2.2; } vec3 getAtmosAttenuation() { @@ -318,7 +323,7 @@ void main() //add environmentmap vec3 env_vec = env_mat * refnormpersp; - col = mix(col.rgb, textureCube(environmentMap, env_vec).rgb, + col = mix(col.rgb, samplesRGB(textureCube(environmentMap, env_vec).rgb) * 2.2, max(spec.a-diffuse.a*2.0, 0.0)); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index 765b0927c3..dd7de9f123 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -27,7 +27,7 @@ VARYING vec3 vary_SunlitColor; VARYING vec3 vary_AdditiveColor; VARYING vec3 vary_AtmosAttenuation; - +uniform float global_gamma; vec3 getSunlitColor() { return vec3(0,0,0); @@ -38,7 +38,7 @@ vec3 getAmblitColor() } vec3 getAdditiveColor() { - return vary_AdditiveColor; + return pow(vary_AdditiveColor, vec3(global_gamma)) * global_gamma; } vec3 getAtmosAttenuation() { diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 99dbee15ee..61f3088648 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -33,18 +33,20 @@ vec3 sunlit_color; vec3 amblit_color; vec3 position_eye; +uniform float global_gamma; + vec3 getSunlitColor() { - return sunlit_color; + return pow(sunlit_color, vec3(global_gamma)) * global_gamma; } vec3 getAmblitColor() { - return amblit_color; + return pow(amblit_color, vec3(global_gamma)) * global_gamma; } vec3 getAdditiveColor() { - return additive_color; + return pow(additive_color, vec3(global_gamma)) * global_gamma; } vec3 getAtmosAttenuation() { |