diff options
author | Graham Linden <graham@lindenlab.com> | 2013-08-06 14:16:46 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2013-08-06 14:16:46 -0700 |
commit | 5b400d50e1f25667e2c865d85fd93546ffe7f96f (patch) | |
tree | f495ec82be8072b47885e0b90d42bcd3a226bd7c /indra/newview/app_settings/shaders/class1 | |
parent | 629bda7cf371f2eb2e7fc9adbfd123d5a079093e (diff) |
NORSPEC-322 NORSPEC-342 fix issues with black impostors and missing alpha attachments on impostors
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rwxr-xr-x | indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index bc0719cb82..d52744103f 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -38,6 +38,31 @@ uniform sampler2D specularMap; VARYING vec2 vary_texcoord0; +vec2 encode_normal(vec3 n) +{ + float f = sqrt(8 * n.z + 8); + return n.xy / f + 0.5; +} + +vec3 linear_to_srgb(vec3 cl) +{ + cl = clamp(cl, vec3(0), vec3(1)); + vec3 low_range = cl * 12.92; + vec3 high_range = 1.055 * pow(cl, vec3(0.41666)) - 0.055; + bvec3 lt = lessThan(cl,vec3(0.0031308)); + +#ifdef OLD_SELECT + vec3 result; + result.r = lt.r ? low_range.r : high_range.r; + result.g = lt.g ? low_range.g : high_range.g; + result.b = lt.b ? low_range.b : high_range.b; + return result; +#else + return mix(high_range, low_range, lt); +#endif + +} + void main() { vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); @@ -47,7 +72,7 @@ void main() discard; } - frag_data[0] = vec4(col.rgb, col.a * 0.005); - frag_data[1] = texture2D(specularMap, vary_texcoord0.xy); - frag_data[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xyz, 0.0); + frag_data[0] = vec4(linear_to_srgb(col.rgb), col.a); + frag_data[1] = vec4(texture2D(specularMap, vary_texcoord0.xy)); + frag_data[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xy,0,0); } |