diff options
author | Dave Houlton <euclid@lindenlab.com> | 2020-02-25 08:05:24 -0700 |
---|---|---|
committer | Dave Houlton <euclid@lindenlab.com> | 2020-02-25 11:50:20 -0700 |
commit | 2ea507526921b68cb5f9929be1a7693203fe608e (patch) | |
tree | a7fc710b082539c06f997f6b366798804efe1386 /indra/newview/app_settings/shaders/class1 | |
parent | dbf464e0fd0df27c18b78a77004b40a8477e0c31 (diff) |
SL-12638, fix overly dark appearance of normal-mapped objects
Adds the 'additive' component of calcAtmosphericVars into the sunlit color to reduce
darkening of sun lighting component, and adds a further magic number gainto boost
final result to rough parity with windlight.
Removes all light calculations on fullbright objects, just passing through the unlit
diffuse color.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl | 3 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 73 |
2 files changed, 20 insertions, 56 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index c104dc884f..39ed9a6e82 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -86,7 +86,6 @@ void main() color.a = final_alpha; #endif - frag_color.rgb = color.rgb; - frag_color.a = color.a; + frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index d28fc128b6..2df683a5fd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -95,19 +95,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe dist /= la; - /* clip to projector bounds - vec4 proj_tc = proj_mat * lp; - - if (proj_tc.z < 0 - || proj_tc.z > 1 - || proj_tc.x < 0 - || proj_tc.x > 1 - || proj_tc.y < 0 - || proj_tc.y > 1) - { - return col; - }*/ - if (dist > 0.0 && la > 0.0) { //normalize light vector @@ -252,7 +239,11 @@ void main() vec3 norm = vec3(0); float bmap_specular = 1.0; + // Non-physical gain, sole purpose to make EEP viewer better match windlight when normal-mapped. + float eep_bump_gain = 1.0; + #ifdef HAS_NORMAL_MAP + eep_bump_gain = 1.75; vec4 bump_sample = texture2D(bumpMap, vary_texcoord1.xy); norm = (bump_sample.xyz * 2) - vec3(1); bmap_specular = bump_sample.w; @@ -295,7 +286,7 @@ void main() vec4 final_normal = vec4(abnormal, env_intensity, 0.0); vec3 color = vec3(0.0); - float al = 0.0; + float al = 1.0; if (emissive_brightness >= 1.0) { @@ -318,7 +309,12 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - if (emissive_brightness <= 1.0) + if (emissive_brightness >= 1.0) + { + // fullbright = diffuse texture pass-through, no lighting + frag_color = diffuse_srgb; + } + else { //forward rendering, output just lit RGBA vec3 pos = vary_position; @@ -348,40 +344,28 @@ void main() float da = dot(norm, normalize(light_dir)); da = clamp(da, 0.0, 1.0); // No negative light contributions - float ambient = da; - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); - - vec3 sun_contrib = min(da, shadow) * sunlit; + // ambient weight varies from 0.75 at max direct light to 1.0 with sun at grazing angle + float ambient = 1.0 - (0.25 * da * da); -// vec3 debug_sun_contrib = sun_contrib; + vec3 sun_contrib = additive + (min(da, shadow) * sunlit); #if !defined(AMBIENT_KILL) color.rgb = amblit; color.rgb *= ambient; #endif -//vec3 debug_post_ambient = color.rgb; - #if !defined(SUNLIGHT_KILL) - color.rgb += sun_contrib; + color.rgb += eep_bump_gain * sun_contrib; #endif -//vec3 debug_post_sunlight = color.rgb; - - //color.rgb *= diffuse_srgb.rgb; color.rgb *= diffuse_linear.rgb; // SL-12006 -//vec3 debug_post_diffuse = color.rgb; - float glare = 0.0; if (spec.a > 0.0) // specular reflection { vec3 npos = -normalize(pos.xyz); - //vec3 ref = dot(pos+lv, norm); vec3 h = normalize(light_dir.xyz+npos); float nh = dot(norm, h); float nv = dot(norm, npos); @@ -404,8 +388,6 @@ void main() } } -//vec3 debug_post_spec = color.rgb; - if (envIntensity > 0.0) { //add environmentmap @@ -422,15 +404,11 @@ void main() glare += cur_glare; } -//vec3 debug_post_env = color.rgb; - color = atmosFragLighting(color, additive, atten); //convert to linear space before adding local lights color = srgb_to_linear(color); -//vec3 debug_post_atmo = color.rgb; - vec3 npos = normalize(-pos.xyz); vec3 light = vec3(0,0,0); @@ -453,32 +431,19 @@ void main() #endif color = scaleSoftClipFrag(color); - + // (only) post-deferred needs inline gamma correction color.rgb = linear_to_srgb(color.rgb); -//color.rgb = amblit; -//color.rgb = vec3(ambient); -//color.rgb = sunlit; -//color.rgb = debug_post_ambient; -//color.rgb = vec3(da); -//color.rgb = debug_sun_contrib; -//color.rgb = debug_post_sunlight; -//color.rgb = diffuse_srgb.rgb; -//color.rgb = debug_post_diffuse; -//color.rgb = debug_post_spec; -//color.rgb = debug_post_env; -//color.rgb = debug_post_atmo; - #ifdef WATER_FOG vec4 temp = applyWaterFogView(pos, vec4(color.rgb, al)); color.rgb = temp.rgb; al = temp.a; #endif - } // !fullbright - frag_color.rgb = color.rgb; - frag_color.a = al; + frag_color.rgb = color.rgb; + frag_color.a = al; + } #else // if DIFFUSE_ALPHA_MODE_BLEND ... |