diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl index c160b38cfe..938947bbce 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/underWaterF.glsl @@ -56,6 +56,26 @@ VARYING vec4 refCoord; VARYING vec4 littleWave; VARYING vec4 view; +vec3 srgb_to_linear(vec3 cs) +{ + +/* { cs / 12.92, cs <= 0.04045 + cl = { + { ((cs + 0.055)/1.055)^2.4, cs > 0.04045*/ + + return pow((cs+vec3(0.055))/vec3(1.055), vec3(2.4)); +} + +vec3 linear_to_srgb(vec3 cl) +{ + /*{ 0.0, 0 <= cl + { 12.92 * c, 0 < cl < 0.0031308 + cs = { 1.055 * cl^0.41666 - 0.055, 0.0031308 <= cl < 1 + { 1.0, cl >= 1*/ + + return 1.055 * pow(cl, vec3(0.41666)) - 0.055; +} + vec2 encode_normal(vec3 n) { float f = sqrt(8 * n.z + 8); @@ -114,7 +134,7 @@ void main() vec4 fb = texture2D(screenTex, distort); - frag_data[0] = vec4(fb.rgb, 0.5); // diffuse + frag_data[0] = vec4(linear_to_srgb(fb.rgb), 1.0); // diffuse frag_data[1] = vec4(0.5,0.5,0.5, 0.95); // speccolor*spec, spec frag_data[2] = vec4(encode_normal(wavef), 0.0, 0.0); // normalxyz, displace } |