diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
4 files changed, 6 insertions, 79 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index c8eaba6418..f9ebf33b4a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -382,8 +382,7 @@ vec3 pbrIbl(vec3 diffuseColor, vec3 irradiance, // irradiance map sample float ao, // ambient occlusion factor float nv, // normal dot view vector - float perceptualRough, - out vec3 specContrib) + float perceptualRough) { // retrieve a scale and bias to F0. See [1], Figure 3 vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough); @@ -393,23 +392,9 @@ vec3 pbrIbl(vec3 diffuseColor, vec3 diffuse = diffuseLight * diffuseColor; vec3 specular = specularLight * (specularColor * brdf.x + brdf.y); - specContrib = specular * ao; - return (diffuse + specular) * ao; } -vec3 pbrIbl(vec3 diffuseColor, - vec3 specularColor, - vec3 radiance, // radiance map sample - vec3 irradiance, // irradiance map sample - float ao, // ambient occlusion factor - float nv, // normal dot view vector - float perceptualRough) -{ - vec3 specContrib; - return pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, nv, perceptualRough, specContrib); -} - // Encapsulate the various inputs used by the various functions in the shading equation // We store values in this struct to simplify the integration of alternative implementations @@ -475,8 +460,7 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 n, // normal vec3 v, // surface point to camera - vec3 l, //surface point to light - out vec3 specContrib) //specular contribution (exposed to alpha shaders to calculate "glare") + vec3 l) //surface point to light { // make sure specular highlights from punctual lights don't fall off of polished surfaces perceptualRoughness = max(perceptualRoughness, 8.0/255.0); @@ -524,28 +508,13 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, // Calculation of analytical lighting contribution vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs); - specContrib = F * G * D / (4.0 * NdotL * NdotV); + vec3 specContrib = F * G * D / (4.0 * NdotL * NdotV); // Obtain final intensity as reflectance (BRDF) scaled by the energy of the light (cosine law) vec3 color = NdotL * (diffuseContrib + specContrib); - specContrib *= NdotL; - specContrib = max(specContrib, vec3(0)); - return clamp(color, vec3(0), vec3(10)); } -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, - float metallic, - vec3 n, // normal - vec3 v, // surface point to camera - vec3 l) //surface point to light -{ - vec3 specContrib; - - return pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n, v, l, specContrib); -} - void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor, inout vec3 specularColor) { vec3 f0 = vec3(0.04); @@ -554,30 +523,21 @@ void calcDiffuseSpecular(vec3 baseColor, float metallic, inout vec3 diffuseColor specularColor = mix(f0, baseColor, metallic); } -vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v, vec3 norm, float perceptualRoughness, vec3 light_dir, vec3 sunlit, float scol, vec3 radiance, vec3 irradiance, vec3 colorEmissive, float ao, vec3 additive, vec3 atten, out vec3 specContrib) +vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v, vec3 norm, float perceptualRoughness, vec3 light_dir, vec3 sunlit, float scol, vec3 radiance, vec3 irradiance, vec3 colorEmissive, float ao, vec3 additive, vec3 atten) { vec3 color = vec3(0); float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0); - vec3 ibl_spec; - color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness, ibl_spec); + color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness); - color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir), specContrib) * sunlit * 3.0 * scol; //magic number to balance with legacy materials - specContrib *= sunlit * 2.75 * scol; - specContrib += ibl_spec; + color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir)) * sunlit * 3.0 * scol; //magic number to balance with legacy materials color += colorEmissive; return color; } -vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v, vec3 norm, float perceptualRoughness, vec3 light_dir, vec3 sunlit, float scol, vec3 radiance, vec3 irradiance, vec3 colorEmissive, float ao, vec3 additive, vec3 atten) -{ - vec3 specContrib; - return pbrBaseLight(diffuseColor, specularColor, metallic, v, norm, perceptualRoughness, light_dir, sunlit, scol, radiance, irradiance, colorEmissive, ao, additive, atten, specContrib); -} - uniform vec4 waterPlane; uniform float waterSign; diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index b752307d13..5d58cc91cd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -40,8 +40,6 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); #endif vec3 srgb_to_linear(vec3 cs); -vec3 legacy_adjust_fullbright(vec3 c); -vec3 legacy_adjust(vec3 c); vec3 linear_to_srgb(vec3 cl); vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten); @@ -98,9 +96,7 @@ void main() #endif #ifndef IS_HUD - color.rgb = legacy_adjust(color.rgb); color.rgb = srgb_to_linear(color.rgb); - color.rgb = legacy_adjust_fullbright(color.rgb); color.rgb = atmosFragLighting(color.rgb, additive, atten); #endif diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl index 31b02377da..e3fd10447e 100644 --- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl @@ -113,31 +113,3 @@ vec3 inv_toneMapACES_Hill(vec3 color) return color; } -// adjust legacy colors to back out tonemapping and exposure -// NOTE: obsolete now that setting probe ambiance to zero removes tonemapping and exposure, but keeping for a minute -// while that change goes through testing - davep 6/1/2023 -#define LEGACY_ADJUST 0 - -vec3 legacy_adjust(vec3 c) -{ -#if LEGACY_ADJUST - vec3 desat = rgb2hsv(c.rgb); - desat.g *= 1.0-(1.0-desat.b)*0.5; - desat.b += (1.0-desat.b)*0.1f; - desat.rgb = hsv2rgb(desat); - return desat; -#else - return c; -#endif -} - -vec3 legacy_adjust_fullbright(vec3 c) -{ -#if LEGACY_ADJUST - float exp_scale = clamp(texture(exposureMap, vec2(0.5, 0.5)).r, 0.01, 10.0); - return c / exp_scale * 1.34; //magic 1.34 arrived at by binary search for a value that reproduces midpoint grey consistenty -#else - return c; -#endif -} - diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index a8aa5a36a3..a1da4b1f9a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -45,7 +45,6 @@ uniform float sky_ambient_scale; float getAmbientClamp() { return 1.0f; } vec3 srgb_to_linear(vec3 col); -vec3 legacy_adjust(vec3 col); // return colors in sRGB space void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, |