diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl | 19 | 
1 files changed, 12 insertions, 7 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index b47fae73af..94711be473 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -544,8 +544,10 @@ vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,          pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv, nl, diffPunc, specPunc);          color = intensity * clamp(nl * (diffPunc + specPunc), vec3(0), vec3(10));      } - -    return color; +    float final_scale = 1.0; +    if (classic_mode > 0) +        final_scale = 0.9; +    return color * final_scale;  }  void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor, inout vec3 specularColor) @@ -576,22 +578,25 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v,      // Depending on the sky, we combine these differently.      if (classic_mode > 0)      { +        irradiance.rgb = srgb_to_linear(irradiance * 0.9); // BINGO +          // Reconstruct the diffuse lighting that we do for blinn-phong materials here.          // A special note about why we do some really janky stuff for classic mode.          // Since adding classic mode, we've moved the lambertian diffuse multiply out from pbrPunctual and instead handle it in the different light type calcs. -        // For classic mode, this baiscally introduces a double multiplication that we need to somehow avoid -        // Using one of the old mobile gamma correction tricks (val * val to "linearize", sqrt(val) to bring back into sRGB), we can _mostly_ avert this          // This will never be 100% correct, but at the very least we can make it look mostly correct with legacy skies and classic mode. -        float da = pow(sqrt(nl), 1.2); +        float da = pow(nl, 1.2);          vec3 sun_contrib = vec3(min(da, scol));          // Multiply by PI to account for lambertian diffuse colors.  Otherwise things will be too dark when lit by the sun on legacy skies. -        sun_contrib = srgb_to_linear(color.rgb * 0.9 + linear_to_srgb(sun_contrib) * sunlit * 0.7) * M_PI; +        sun_contrib = srgb_to_linear(linear_to_srgb(sun_contrib) * sunlit * 0.7) * M_PI;          // Manually recombine everything here.  We have to separate the shading to ensure that lighting is able to more closely match blinn-phong. -        color.rgb = srgb_to_linear(iblDiff) + clamp(sun_contrib * (da * (diffPunc.rgb + specPunc.rgb) * scol), vec3(0), vec3(10)); +        vec3 finalAmbient = irradiance.rgb * diffuseColor.rgb; // BINGO +        vec3 finalSun = clamp(sun_contrib * ((diffPunc.rgb + specPunc.rgb) * scol), vec3(0), vec3(10)); // QUESTIONABLE BINGO? +        color.rgb = srgb_to_linear(linear_to_srgb(finalAmbient) + (linear_to_srgb(finalSun) * 1.1)); +        //color.rgb = sun_contrib * diffuseColor.rgb;      }      else      { | 
