DRTVWR-559 Balance night scenes against release, nudge glow down a smidge, remove exposure correction from legacy fullbright balance PBR materials against legacy.
parent
d32bca67f1
commit
03bd681564
|
|
@ -10010,7 +10010,7 @@
|
|||
<key>Type</key>
|
||||
<string>F32</string>
|
||||
<key>Value</key>
|
||||
<real>0.35</real>
|
||||
<real>0.325</real>
|
||||
</map>
|
||||
<key>RenderGlowWarmthAmount</key>
|
||||
<map>
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ vec3 pbrIbl(vec3 diffuseColor,
|
|||
{
|
||||
// retrieve a scale and bias to F0. See [1], Figure 3
|
||||
vec2 brdf = BRDF(clamp(nv, 0, 1), 1.0-perceptualRough);
|
||||
vec3 diffuseLight = irradiance;
|
||||
vec3 diffuseLight = irradiance*1.25; //magic 1.25 to balance with legacy materials
|
||||
vec3 specularLight = radiance;
|
||||
|
||||
vec3 diffuse = diffuseLight * diffuseColor;
|
||||
|
|
@ -563,7 +563,7 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v,
|
|||
vec3 ibl_spec;
|
||||
color += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness, ibl_spec);
|
||||
|
||||
color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir), specContrib) * sunlit * 2.75 * scol;
|
||||
color += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm, v, normalize(light_dir), specContrib) * sunlit * 3.9 * scol; //magic number to balance with legacy materials
|
||||
specContrib *= sunlit * 2.75 * scol;
|
||||
specContrib += ibl_spec;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,8 @@ VARYING vec2 vary_texcoord0;
|
|||
|
||||
void main()
|
||||
{
|
||||
float shadow = 1.0;
|
||||
|
||||
vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color;
|
||||
color.rgb = fullbrightAtmosTransport(color.rgb);
|
||||
|
||||
frag_color = max(color, vec4(0));
|
||||
// NOTE: when this shader is used, only alpha is being written to
|
||||
float a = diffuseLookup(vary_texcoord0.xy).a*vertex_color.a;
|
||||
frag_color = vec4(0, 0, 0, a);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ 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 fullbrightAtmosTransport(vec3 light);
|
||||
|
|
@ -90,8 +91,8 @@ void main()
|
|||
#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 = fullbrightAtmosTransport(color.rgb);
|
||||
|
||||
#endif
|
||||
|
||||
frag_color = max(color, vec4(0));
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ void main()
|
|||
vary_LightNormPosDot = rel_pos_lightnorm_dot;
|
||||
|
||||
// Initialize temp variables
|
||||
vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
|
||||
vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color * 0.7; //magic 0.7 to match legacy color
|
||||
|
||||
// Sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@
|
|||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
uniform sampler2D exposureMap;
|
||||
|
||||
vec3 srgb_to_linear(vec3 cs)
|
||||
{
|
||||
vec3 low_range = cs / vec3(12.92);
|
||||
|
|
@ -83,12 +85,32 @@ vec3 hsv2rgb(vec3 c)
|
|||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
|
||||
vec3 legacy_adjust_no_brighten(vec3 c)
|
||||
const mat3 inv_ACESOutputMat = mat3(0.643038, 0.0592687, 0.0059619, 0.311187, 0.931436, 0.063929, 0.0457755, 0.00929492, 0.930118 );
|
||||
|
||||
const mat3 inv_ACESInputMat = mat3( 1.76474, -0.147028, -0.0363368, -0.675778, 1.16025, -0.162436, -0.0889633, -0.0132237, 1.19877 );
|
||||
|
||||
vec3 inv_RRTAndODTFit(vec3 x)
|
||||
{
|
||||
vec3 desat = rgb2hsv(c.rgb);
|
||||
desat.g *= 0.75;
|
||||
desat.rgb = hsv2rgb(desat);
|
||||
return desat;
|
||||
float A = 0.0245786;
|
||||
float B = 0.000090537;
|
||||
float C = 0.983729;
|
||||
float D = 0.4329510;
|
||||
float E = 0.238081;
|
||||
|
||||
return (A - D * x)/(2.0 * (C * x - 1.0)) - sqrt(pow(D * x - A, vec3(2.0)) - 4.0 * (C * x - 1.0) * (B + E * x))/(2.0 * (C * x - 1.0));
|
||||
}
|
||||
|
||||
// experimental inverse of ACES Hill tonemapping
|
||||
vec3 inv_toneMapACES_Hill(vec3 color)
|
||||
{
|
||||
color = inv_ACESOutputMat * color;
|
||||
|
||||
// Apply RRT and ODT
|
||||
color = inv_RRTAndODTFit(color);
|
||||
|
||||
color = inv_ACESInputMat * color;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
vec3 legacy_adjust(vec3 c)
|
||||
|
|
@ -100,6 +122,13 @@ vec3 legacy_adjust(vec3 c)
|
|||
return desat;
|
||||
}
|
||||
|
||||
vec3 legacy_adjust_fullbright(vec3 c)
|
||||
{
|
||||
float exp_scale = texture(exposureMap, vec2(0.5, 0.5)).r;
|
||||
return c / exp_scale * 1.34;
|
||||
}
|
||||
|
||||
|
||||
vec3 legacy_adjust_post(vec3 c)
|
||||
{
|
||||
return c;
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ vec3 calcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor,
|
|||
// spot*spot => GL_SPOT_EXPONENT=2
|
||||
float spot_atten = spot*spot;
|
||||
|
||||
vec3 intensity = spot_atten * dist_atten * lightColor * 3.0;
|
||||
vec3 intensity = spot_atten * dist_atten * lightColor * 3.9; //magic number to balance with legacy materials
|
||||
|
||||
vec3 speccol;
|
||||
color = intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv, speccol);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ uniform float sun_moon_glow_factor;
|
|||
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,
|
||||
|
|
@ -63,8 +64,8 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
|
|||
vec3 rel_pos_norm = normalize(rel_pos);
|
||||
float rel_pos_len = length(rel_pos);
|
||||
|
||||
vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color;
|
||||
|
||||
vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color * 0.7; // magic 0.7 to match legacy color
|
||||
|
||||
// sunlight attenuation effect (hue and brightness) due to atmosphere
|
||||
// this is used later for sunlight modulation at various altitudes
|
||||
vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ void main()
|
|||
|
||||
float dist_atten = calcLegacyDistanceAttenuation(dist, falloff);
|
||||
|
||||
vec3 intensity = dist_atten * lightColor * 3.0;
|
||||
vec3 intensity = dist_atten * lightColor * 3.9;
|
||||
|
||||
final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, lv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ void main()
|
|||
|
||||
dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
|
||||
|
||||
vec3 intensity = dist_atten * dlit * 3.0 * shadow; // Legacy attenuation
|
||||
vec3 intensity = dist_atten * dlit * 3.9 * shadow; // Legacy attenuation, magic number to balance with legacy materials
|
||||
final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ void main()
|
|||
|
||||
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
|
||||
|
||||
vec3 intensity = dist_atten * color * 3.0; // Legacy attenuation
|
||||
vec3 intensity = dist_atten * color * 3.9; // Legacy attenuation, magic number to balance with legacy materials
|
||||
final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ void main()
|
|||
|
||||
dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );
|
||||
|
||||
vec3 intensity = dist_atten * dlit * 3.0 * shadow; // Legacy attenuation
|
||||
vec3 intensity = dist_atten * dlit * 3.9 * shadow; // Legacy attenuation
|
||||
final_color += intensity*pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, n.xyz, v, normalize(lv));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,6 +140,12 @@ static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma, bool d
|
|||
shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f);
|
||||
}
|
||||
|
||||
S32 channel = shader->enableTexture(LLShaderMgr::EXPOSURE_MAP);
|
||||
if (channel > -1)
|
||||
{
|
||||
gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap);
|
||||
}
|
||||
|
||||
//also prepare rigged variant
|
||||
if (shader->mRiggedVariant && shader->mRiggedVariant != shader)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -62,6 +62,13 @@ static void setup_glow_shader(LLGLSLShader* shader)
|
|||
static void setup_fullbright_shader(LLGLSLShader* shader)
|
||||
{
|
||||
setup_glow_shader(shader);
|
||||
|
||||
S32 channel = shader->enableTexture(LLShaderMgr::EXPOSURE_MAP);
|
||||
if (channel > -1)
|
||||
{
|
||||
gGL.getTexUnit(channel)->bind(&gPipeline.mExposureMap);
|
||||
}
|
||||
|
||||
shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7696,6 +7696,12 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
|
|||
stop_glerror();
|
||||
}
|
||||
|
||||
channel = shader.enableTexture(LLShaderMgr::EXPOSURE_MAP);
|
||||
if (channel > -1)
|
||||
{
|
||||
gGL.getTexUnit(channel)->bind(&mExposureMap);
|
||||
}
|
||||
|
||||
if (shader.getUniformLocation(LLShaderMgr::VIEWPORT) != -1)
|
||||
{
|
||||
shader.uniform4f(LLShaderMgr::VIEWPORT, (F32) gGLViewport[0],
|
||||
|
|
|
|||
Loading…
Reference in New Issue