summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl7
-rw-r--r--indra/newview/pipeline.cpp8
9 files changed, 71 insertions, 27 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
{
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 89fe4b6007..02aaf24194 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -163,7 +163,10 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
// no spec for alpha shader...
}
- col = max(col, vec3(0));
+ float final_scale = 1.0;
+ if (classic_mode > 0)
+ final_scale = 0.9;
+ col = max(col * final_scale, vec3(0));
return col;
}
@@ -241,7 +244,8 @@ void main()
vec3 atten;
calcAtmosphericVarsLinear(pos.xyz, norm, light_dir, sunlit, amblit, additive, atten);
-
+ if (classic_mode > 0)
+ sunlit *= 1.35;
vec3 sunlit_linear = sunlit;
vec3 amblit_linear = amblit;
@@ -296,11 +300,14 @@ void main()
color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, color).rgb;
#endif // #else // FOR_IMPOSTOR
-
+ float final_scale = 1;
+ if (classic_mode > 0)
+ final_scale = 1.1;
#ifdef IS_HUD
color.rgb = linear_to_srgb(color.rgb);
+ final_scale = 1;
#endif
- frag_color = max(color, vec4(0));
+ frag_color = max(color * final_scale, vec4(0));
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index cec844559f..0418f99459 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -43,6 +43,7 @@ uniform sampler2D lightMap;
uniform int sun_up_factor;
uniform vec3 sun_dir;
uniform vec3 moon_dir;
+uniform int classic_mode;
out vec4 frag_color;
@@ -160,7 +161,8 @@ void main()
vec3 additive;
vec3 atten;
calcAtmosphericVarsLinear(pos.xyz, norm, light_dir, sunlit, amblit, additive, atten);
-
+ if (classic_mode > 0)
+ sunlit *= 1.35;
vec3 sunlit_linear = sunlit;
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
@@ -212,8 +214,10 @@ void main()
color.rgb = applySkyAndWaterFog(pos.xyz, additive, atten, vec4(color, 1.0)).rgb;
float a = basecolor.a*vertex_color.a;
-
- frag_color = max(vec4(color.rgb,a), vec4(0));
+ float final_scale = 1;
+ if (classic_mode > 0)
+ final_scale = 1.1;
+ frag_color = max(vec4(color.rgb * final_scale,a), vec4(0));
}
#else
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index e15317f5b5..7f871c0d5e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -178,8 +178,10 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
}
}
}
-
- return max(col, vec3(0.0, 0.0, 0.0));
+ float final_scale = 1.0;
+ if (classic_mode > 0)
+ final_scale = 0.9;
+ return max(col * final_scale, vec3(0.0, 0.0, 0.0));
}
#else
@@ -329,7 +331,8 @@ void main()
vec3 additive;
vec3 atten;
calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);
-
+ if (classic_mode > 0)
+ sunlit *= 1.35;
vec3 sunlit_linear = sunlit;
vec3 amblit_linear = amblit;
@@ -418,8 +421,10 @@ void main()
glare *= 1.0-emissive;
glare = min(glare, 1.0);
float al = max(diffcol.a, glare) * vertex_color.a;
-
- frag_color = max(vec4(color, al), vec4(0));
+ float final_scale = 1;
+ if (classic_mode > 0)
+ final_scale = 1.1;
+ frag_color = max(vec4(color * final_scale, al), vec4(0));
#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer
// deferred path // See: C++: addDeferredAttachment(), shader: softenLightF.glsl
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
index 8db3bcd363..96cda1ef49 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
@@ -38,6 +38,7 @@ uniform vec4 light_col[LIGHT_COUNT]; // .a = falloff
uniform vec2 screen_res;
uniform float far_z;
uniform mat4 inv_proj;
+uniform int classic_mode;
in vec4 vary_fragcoord;
@@ -169,8 +170,10 @@ void main()
}
}
}
-
- frag_color.rgb = max(final_color, vec3(0));
+ float final_scale = 1.0;
+ if (classic_mode > 0)
+ final_scale = 0.9;
+ frag_color.rgb = max(final_color * final_scale, vec3(0));
frag_color.a = 0.0;
#ifdef IS_AMD_CARD
diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
index 987089fcc9..ceb37f36a5 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl
@@ -44,6 +44,7 @@ uniform vec2 screen_res;
uniform mat4 inv_proj;
uniform vec4 viewport;
+uniform int classic_mode;
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
float calcLegacyDistanceAttenuation(float distance, float falloff);
@@ -149,7 +150,9 @@ void main()
discard;
}
}
-
- frag_color.rgb = max(final_color, vec3(0));
+ float final_scale = 1.0;
+ if (classic_mode > 0)
+ final_scale = 0.9;
+ frag_color.rgb = max(final_color * final_scale, vec3(0));
frag_color.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 52799dbba1..aac75a0739 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -155,6 +155,9 @@ void main()
calcAtmosphericVarsLinear(pos.xyz, gb.normal, light_dir, sunlit, amblit, additive, atten);
+ if (classic_mode > 0)
+ sunlit *= 1.35;
+
vec3 sunlit_linear = sunlit;
vec3 amblit_linear = amblit;
@@ -224,7 +227,7 @@ void main()
da = pow(da,1.2);
vec3 sun_contrib = vec3(min(da, scol));
- color.rgb = srgb_to_linear(color.rgb * 0.9 + linear_to_srgb(sun_contrib) * sunlit_linear * 0.7);
+ color.rgb = srgb_to_linear(color.rgb * 0.9 + (linear_to_srgb(sun_contrib) * sunlit_linear * 0.7));
sunlit_linear = srgb_to_linear(sunlit_linear);
}
else
@@ -272,6 +275,9 @@ void main()
}
//color.r = classic_mode > 0 ? 1.0 : 0.0;
- frag_color.rgb = max(color.rgb, vec3(0)); //output linear since local lights will be added to this shader's results
+ float final_scale = 1;
+ if (classic_mode > 0)
+ final_scale = 1.1;
+ frag_color.rgb = max(color.rgb * final_scale, vec3(0)); //output linear since local lights will be added to this shader's results
frag_color.a = 0.0;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
index 78db8ccf5b..a46e3688dc 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl
@@ -47,6 +47,7 @@ uniform vec3 proj_origin; //origin of projection to be used for angular attenuat
uniform float sun_wash;
uniform int proj_shadow_idx;
uniform float shadow_fade;
+uniform int classic_mode;
// Light params
#if defined(MULTI_SPOTLIGHT)
@@ -267,8 +268,10 @@ void main()
//not sure why, but this line prevents MATBUG-194
final_color = max(final_color, vec3(0.0));
-
+ float final_scale = 1.0;
+ if (classic_mode > 0)
+ final_scale = 0.9;
//output linear
- frag_color.rgb = final_color;
+ frag_color.rgb = final_color * final_scale;
frag_color.a = 0.0;
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 1221601c97..e92d59e4e4 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -8518,6 +8518,7 @@ void LLPipeline::renderDeferredLighting()
std::list<LLVector4> fullscreen_lights;
LLDrawable::drawable_list_t spot_lights;
LLDrawable::drawable_list_t fullscreen_spot_lights;
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
if (!gCubeSnapshot)
{
@@ -8613,6 +8614,8 @@ void LLPipeline::renderDeferredLighting()
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
gDeferredLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF));
+ gDeferredLightProgram.uniform1i(LLShaderMgr::CLASSIC_MODE, (psky->canAutoAdjust()) ? 1 : 0);
+
gGL.syncMatrices();
mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
@@ -8673,6 +8676,8 @@ void LLPipeline::renderDeferredLighting()
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, volume->getLightFalloff(DEFERRED_LIGHT_FALLOFF));
+ gDeferredSpotLightProgram.uniform1i(LLShaderMgr::CLASSIC_MODE, (psky->canAutoAdjust()) ? 1 : 0);
+
gGL.syncMatrices();
mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(camera, center));
@@ -8711,6 +8716,7 @@ void LLPipeline::renderDeferredLighting()
gDeferredMultiLightProgram[idx].uniform4fv(LLShaderMgr::MULTI_LIGHT, count, (GLfloat*)light);
gDeferredMultiLightProgram[idx].uniform4fv(LLShaderMgr::MULTI_LIGHT_COL, count, (GLfloat*)col);
gDeferredMultiLightProgram[idx].uniform1f(LLShaderMgr::MULTI_LIGHT_FAR_Z, far_z);
+ gDeferredMultiLightProgram[idx].uniform1i(LLShaderMgr::CLASSIC_MODE, (psky->canAutoAdjust()) ? 1 : 0);
far_z = 0.f;
count = 0;
mScreenTriangleVB->setBuffer();
@@ -8748,6 +8754,8 @@ void LLPipeline::renderDeferredLighting()
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, light_size_final);
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::DIFFUSE_COLOR, 1, col.mV);
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_FALLOFF, light_falloff_final);
+ gDeferredMultiSpotLightProgram.uniform1i(LLShaderMgr::CLASSIC_MODE, (psky->canAutoAdjust()) ? 1 : 0);
+
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
}