diff options
author | Dave Parks <davep@lindenlab.com> | 2013-05-29 18:48:09 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2013-05-29 18:48:09 -0500 |
commit | 743d1a777e5c2827d50051c3f5e0942a870a6ff9 (patch) | |
tree | 67f264a5c799003a0eaebcd5e729c315f53a42bc /indra/newview/app_settings/shaders/class1 | |
parent | e6de3d6232a12ace8f669abd4ede4c6f586046df (diff) |
NORSPEC-198, NORSPEC-176, NORSPEC-106, NORSPEC-202 et al -- Material matrix testing based overhaul WIP
Reviewed by Graham
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
4 files changed, 72 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index efb4d48845..5c164f7759 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -31,6 +31,10 @@ out vec4 frag_color; #define frag_color gl_FragColor #endif +#if !HAS_DIFFUSE_LOOKUP +uniform sampler2D diffuseMap; +#endif + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; @@ -40,7 +44,12 @@ vec3 fullbrightScaleSoftClip(vec3 light); void main() { +#if HAS_DIFFUSE_LOOKUP vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; +#else + vec4 color = texture2D(diffuseMap, vary_texcoord0.xy)*vertex_color; +#endif + color.rgb = pow(color.rgb,vec3(2.2f,2.2f,2.2f)); color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 539efa3499..17aa0e32a7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -28,9 +28,7 @@ #define DIFFUSE_ALPHA_MODE_MASK 2 #define DIFFUSE_ALPHA_MODE_EMISSIVE 3 -#if DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE uniform float emissive_brightness; -#endif #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) @@ -388,6 +386,18 @@ vec3 scaleSoftClip(vec3 light) return light; } +vec3 fullbrightAtmosTransport(vec3 light) { + float brightness = dot(light.rgb, vec3(0.33333)); + + return mix(atmosTransport(light.rgb), light.rgb + getAdditiveColor().rgb, brightness * brightness); +} + +vec3 fullbrightScaleSoftClip(vec3 light) +{ + //soft clip effect: + return light; +} + #else #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_data[3]; @@ -446,6 +456,7 @@ void main() #endif #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) + vec3 old_diffcol = diffcol.rgb; diffcol.rgb = pow(diffcol.rgb, vec3(2.2)); #endif @@ -475,6 +486,8 @@ void main() #if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE) final_color.a = emissive_brightness; +#else + final_color.a = max(final_color.a, emissive_brightness); #endif vec4 final_specular = spec; @@ -613,24 +626,33 @@ void main() col += spec_contrib; } + col = mix(col.rgb, old_diffcol.rgb, diffuse.a); + if (envIntensity > 0.0) { //add environmentmap vec3 env_vec = env_mat * refnormpersp; - vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(2.2)) * 2.2; + float exponent = mix(2.2, 1.0, diffuse.a); + + vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent; col = mix(col.rgb, refcol, - max(envIntensity-diffuse.a*2.0, 0.0)); - + envIntensity); + float cur_glare = max(refcol.r, refcol.g); cur_glare = max(cur_glare, refcol.b); cur_glare *= envIntensity*4.0; glare += cur_glare; } + + float exponent = mix(1.0, 2.2, diffuse.a); + col = pow(col, vec3(exponent)); + - col = atmosLighting(col); - col = scaleSoftClip(col); + col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a); + col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); + vec3 npos = normalize(-pos.xyz); #define LIGHT_LOOP(i) col.rgb = col.rgb + calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare); @@ -646,7 +668,6 @@ void main() frag_color.rgb = col.rgb; glare = min(glare, 1.0); frag_color.a = max(diffcol.a*vertex_color.a, glare); - #else frag_data[0] = final_color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index b688c1a70c..45d672c290 100755 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -248,6 +248,15 @@ vec3 atmosTransport(vec3 light) { light += getAdditiveColor() * 2.0; return light; } + +vec3 fullbrightAtmosTransport(vec3 light) { + float brightness = dot(light.rgb, vec3(0.33333)); + + return mix(atmosTransport(light.rgb), light.rgb + getAdditiveColor().rgb, brightness * brightness); +} + + + vec3 atmosGetDiffuseSunlightColor() { return getSunlitColor(); @@ -282,6 +291,13 @@ vec3 scaleSoftClip(vec3 light) return light; } + +vec3 fullbrightScaleSoftClip(vec3 light) +{ + //soft clip effect: + return light; +} + void main() { vec2 tc = vary_fragcoord.xy; @@ -328,32 +344,36 @@ void main() col += spec_contrib; } - col = mix(col.rgb, diffuse.rgb, diffuse.a); - + + col = mix(col.rgb, pow(diffuse.rgb, vec3(1.0/2.2)), diffuse.a); + + if (envIntensity > 0.0) { //add environmentmap vec3 env_vec = env_mat * refnormpersp; float exponent = mix(2.2, 1.0, diffuse.a); + vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent; - col = mix(col.rgb, pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent)) * exponent, - envIntensity); + col = mix(col.rgb, refcol, + envIntensity); - exponent = mix(1.0, 2.2, diffuse.a); - col.rgb = pow(col.rgb, vec3(exponent))/exponent; } + float exponent = mix(1.0, 2.2, diffuse.a); + col = pow(col, vec3(exponent)); + if (norm.w < 0.5) { - col = atmosLighting(col); - col = scaleSoftClip(col); + col = mix(atmosLighting(col), fullbrightAtmosTransport(col), diffuse.a); + col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); } + //col = vec3(1,0,1); //col.g = envIntensity; } frag_color.rgb = col; - //frag_color.a = bloom; - frag_color.a = 0.0; + frag_color.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl index 2ff7f795b0..361f316065 100755 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl @@ -32,6 +32,8 @@ out vec4 frag_color; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; +uniform float texture_gamma; + vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); @@ -39,6 +41,8 @@ void fullbright_lighting() { vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; + color.rgb = pow(color.rgb, vec3(texture_gamma)); + color.rgb = fullbrightAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); |