From 8c2b7e0e83566e9a27a65856d5ae7fbe3558422f Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 3 Mar 2020 16:39:17 -0700 Subject: Revert 2 merges (PR#13, PR#16) related to SL-12638 This reverts commits 9d9b890 and 5f846e4. --- .../shaders/class1/deferred/fullbrightF.glsl | 3 +- .../shaders/class1/deferred/materialF.glsl | 81 ++++++++++++++-------- 2 files changed, 54 insertions(+), 30 deletions(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 39ed9a6e82..c104dc884f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -86,6 +86,7 @@ void main() color.a = final_alpha; #endif - frag_color = color; + frag_color.rgb = color.rgb; + frag_color.a = color.a; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index eebb0a5fe5..d28fc128b6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -95,6 +95,19 @@ 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 @@ -164,14 +177,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe return max(col, vec3(0.0,0.0,0.0)); } -// Q&D approximate RGB-space de-saturation, strength from 0 (no effect) to 1.0 (complete grey-scale) -vec3 desat(vec3 color, float strength) -{ - float primary_value = max(color.r, max(color.g, color.b)); - vec3 delta = strength * (vec3(primary_value)-color); - return color + delta; -} - #else #ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_data[3]; @@ -247,11 +252,7 @@ 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; @@ -294,7 +295,7 @@ void main() vec4 final_normal = vec4(abnormal, env_intensity, 0.0); vec3 color = vec3(0.0); - float al = 1.0; + float al = 0.0; if (emissive_brightness >= 1.0) { @@ -317,12 +318,7 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - if (emissive_brightness >= 1.0) - { - // fullbright = diffuse texture pass-through, no lighting - frag_color = diffuse_srgb; - } - else + if (emissive_brightness <= 1.0) { //forward rendering, output just lit RGBA vec3 pos = vary_position; @@ -352,25 +348,32 @@ void main() float da = dot(norm, normalize(light_dir)); da = clamp(da, 0.0, 1.0); // No negative light contributions - // 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); + float ambient = da; + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0 - ambient); + + vec3 sun_contrib = min(da, shadow) * sunlit; - vec3 sun_contrib = additive + (min(da, shadow) * sunlit); +// vec3 debug_sun_contrib = sun_contrib; #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; #endif +//vec3 debug_post_sunlight = color.rgb; + + //color.rgb *= diffuse_srgb.rgb; color.rgb *= diffuse_linear.rgb; // SL-12006 - // ad-hoc brighten and de-saturate (normal-mapped only), to match windlight - SL-12638 - color.rgb = desat(color.rgb, 0.33 * (eep_bump_gain - 1.0)); - color.rgb *= eep_bump_gain; +//vec3 debug_post_diffuse = color.rgb; float glare = 0.0; @@ -378,6 +381,7 @@ void main() { 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); @@ -400,6 +404,8 @@ void main() } } +//vec3 debug_post_spec = color.rgb; + if (envIntensity > 0.0) { //add environmentmap @@ -416,11 +422,15 @@ 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); @@ -443,19 +453,32 @@ 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 ... -- cgit v1.2.3 From 1ba0df9abe26a18f2c870210be9b8fe6a1c72699 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 3 Mar 2020 17:13:46 -0700 Subject: Roll back SL-12006 commits to materialF.glsl (Dec23) --- .../shaders/class1/deferred/materialF.glsl | 69 ++++------------------ 1 file changed, 11 insertions(+), 58 deletions(-) (limited to 'indra/newview/app_settings') diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index d28fc128b6..0829968dd1 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 @@ -273,7 +260,6 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_EMISSIVE) final_color.a = diffuse_linear.a; - final_color.rgb = mix( diffuse_linear.rgb, final_color.rgb*0.5, diffuse_tap.a ); // SL-12171: Fix emissive texture portion being twice as bright. #endif final_color.a = max(final_color.a, emissive_brightness); @@ -295,17 +281,15 @@ void main() vec4 final_normal = vec4(abnormal, env_intensity, 0.0); vec3 color = vec3(0.0); - float al = 0.0; + float al = 0; +#ifdef HAS_SPECULAR_MAP if (emissive_brightness >= 1.0) { -#ifdef HAS_SPECULAR_MAP - // Note: We actually need to adjust all 4 channels not just .rgb - final_color *= 0.666666; -#endif - color.rgb = final_color.rgb; - al = vertex_color.a; + float ei = env_intensity*0.5 + 0.5; + final_normal = vec4(abnormal, ei, 0.0); } +#endif vec4 final_specular = spec; @@ -318,7 +302,6 @@ void main() #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - if (emissive_brightness <= 1.0) { //forward rendering, output just lit RGBA vec3 pos = vary_position; @@ -348,33 +331,22 @@ 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); + // 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 sun_contrib = min(da, shadow) * sunlit; -// vec3 debug_sun_contrib = sun_contrib; - #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; #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; - + color.rgb *= diffuse_srgb.rgb; + float glare = 0.0; if (spec.a > 0.0) // specular reflection @@ -404,8 +376,6 @@ void main() } } -//vec3 debug_post_spec = color.rgb; - if (envIntensity > 0.0) { //add environmentmap @@ -422,15 +392,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); @@ -457,30 +423,17 @@ void main() // (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; -#else // if DIFFUSE_ALPHA_MODE_BLEND ... +#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer // deferred path frag_data[0] = final_color; -- cgit v1.2.3