summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/srgbF.glsl5
-rw-r--r--indra/newview/llviewershadermgr.cpp37
-rw-r--r--indra/newview/llviewershadermgr.h2
-rw-r--r--indra/newview/llvovolume.cpp4
-rw-r--r--indra/newview/pipeline.cpp33
-rw-r--r--indra/newview/skins/default/xui/en/floater_adjust_environment.xml2
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml33
-rw-r--r--indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml2
10 files changed, 115 insertions, 45 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index cda71dd9b0..97f07e5952 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -9230,6 +9230,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>RenderDisablePostProcessing</key>
+ <map>
+ <key>Comment</key>
+ <string>Disable tone mapping and exposure correction when build floater is open (for artists developing materials)</string>
+ <key>Persist</key>
+ <integer>0</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>RenderMaxOpenGLVersion</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 82d7bb9835..80816912da 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -104,20 +104,20 @@ vec3 toneMapACES_Hill(vec3 color)
uniform float exposure;
uniform float gamma;
-vec3 legacy_adjust_post(vec3 c);
-
-vec3 toneMap(vec3 color, float gs)
+vec3 toneMap(vec3 color)
{
+#ifndef NO_POST
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
- color *= exposure * exp_scale * gs;
+ color *= exposure * exp_scale;
color = toneMapACES_Hill(color);
+#else
+ color *= 0.6;
+#endif
color = linear_to_srgb(color);
- color = legacy_adjust_post(color);
-
return color;
}
@@ -170,22 +170,19 @@ vec3 legacyGamma(vec3 color)
return color;
}
-float legacyGammaApprox()
-{
- //TODO -- figure out how to plumb this in as a uniform
- float c = 0.5;
- float gc = 1.0-pow(c, gamma);
-
- return gc/c * gamma;
-}
-
void main()
{
//this is the one of the rare spots where diffuseRect contains linear color values (not sRGB)
vec4 diff = texture2D(diffuseRect, vary_fragcoord);
- diff.rgb = toneMap(diff.rgb, legacyGammaApprox());
-
+ diff.rgb = toneMap(diff.rgb);
+
+#ifdef LEGACY_GAMMA
+#ifndef NO_POST
+ diff.rgb = legacyGamma(diff.rgb);
+#endif
+#endif
+
vec2 tc = vary_fragcoord.xy*screen_res*4.0;
vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y);
vec3 nz = vec3(noise(seed.rg), noise(seed.gb), noise(seed.rb));
diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
index 35f2395ef1..3817633df0 100644
--- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
@@ -128,8 +128,3 @@ vec3 legacy_adjust_fullbright(vec3 c)
return c / exp_scale * 1.34;
}
-
-vec3 legacy_adjust_post(vec3 c)
-{
- return c;
-}
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 63cc7ba623..8925cc2f9b 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -188,6 +188,8 @@ LLGLSLShader gDeferredPostProgram;
LLGLSLShader gDeferredCoFProgram;
LLGLSLShader gDeferredDoFCombineProgram;
LLGLSLShader gDeferredPostGammaCorrectProgram;
+LLGLSLShader gNoPostGammaCorrectProgram;
+LLGLSLShader gLegacyPostGammaCorrectProgram;
LLGLSLShader gExposureProgram;
LLGLSLShader gLuminanceProgram;
LLGLSLShader gFXAAProgram;
@@ -295,6 +297,8 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gHUDPBRAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedPBRAlphaProgram);
mShaderList.push_back(&gDeferredPostGammaCorrectProgram); // for gamma
+ mShaderList.push_back(&gNoPostGammaCorrectProgram);
+ mShaderList.push_back(&gLegacyPostGammaCorrectProgram);
}
@@ -1010,6 +1014,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gExposureProgram.unload();
gLuminanceProgram.unload();
gDeferredPostGammaCorrectProgram.unload();
+ gNoPostGammaCorrectProgram.unload();
+ gLegacyPostGammaCorrectProgram.unload();
gFXAAProgram.unload();
gDeferredWLSkyProgram.unload();
gDeferredWLCloudProgram.unload();
@@ -2537,6 +2543,37 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
success = gDeferredPostGammaCorrectProgram.createShader(NULL, NULL);
llassert(success);
}
+
+ if (success)
+ {
+ gNoPostGammaCorrectProgram.mName = "No Post Gamma Correction Post Process";
+ gNoPostGammaCorrectProgram.mFeatures.hasSrgb = true;
+ gNoPostGammaCorrectProgram.mFeatures.isDeferred = true;
+ gNoPostGammaCorrectProgram.mShaderFiles.clear();
+ gNoPostGammaCorrectProgram.clearPermutations();
+ gNoPostGammaCorrectProgram.addPermutation("NO_POST", "1");
+ gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
+ gNoPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER));
+ gNoPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gNoPostGammaCorrectProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
+ if (success)
+ {
+ gLegacyPostGammaCorrectProgram.mName = "Legacy Gamma Correction Post Process";
+ gLegacyPostGammaCorrectProgram.mFeatures.hasSrgb = true;
+ gLegacyPostGammaCorrectProgram.mFeatures.isDeferred = true;
+ gLegacyPostGammaCorrectProgram.mShaderFiles.clear();
+ gLegacyPostGammaCorrectProgram.clearPermutations();
+ gLegacyPostGammaCorrectProgram.addPermutation("LEGACY_GAMMA", "1");
+ gLegacyPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER));
+ gLegacyPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER));
+ gLegacyPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gLegacyPostGammaCorrectProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
+
if (success && gGLManager.mGLVersion > 3.9f)
{
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 129802aca5..492e60b840 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -235,6 +235,8 @@ extern LLGLSLShader gDeferredDoFCombineProgram;
extern LLGLSLShader gFXAAProgram;
extern LLGLSLShader gDeferredPostNoDoFProgram;
extern LLGLSLShader gDeferredPostGammaCorrectProgram;
+extern LLGLSLShader gNoPostGammaCorrectProgram;
+extern LLGLSLShader gLegacyPostGammaCorrectProgram;
extern LLGLSLShader gExposureProgram;
extern LLGLSLShader gLuminanceProgram;
extern LLGLSLShader gDeferredAvatarShadowProgram;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 3061b07259..12ceb86e52 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5833,7 +5833,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
const LLTextureEntry* te = facep->getTextureEntry();
LLViewerTexture* tex = facep->getTexture();
- if (te->getGlow() >= 1.f/255.f)
+ if (te->getGlow() > 0.f)
{
emissive = true;
}
@@ -5917,7 +5917,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
LLGLTFMaterial* gltf_mat = te->getGLTFRenderMaterial();
- if (gltf_mat != nullptr || (te->getMaterialParams().notNull() && !te->getMaterialID().isNull()))
+ if (gltf_mat != nullptr || (te->getMaterialParams().notNull()))
{
if (gltf_mat != nullptr)
{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index adfac1f934..c482256309 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -963,7 +963,7 @@ void LLPipeline::refreshCachedSettings()
WindLightUseAtmosShaders = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("WindLightUseAtmosShaders");
RenderDeferred = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("RenderDeferred");
RenderDeferredSunWash = gSavedSettings.getF32("RenderDeferredSunWash");
- RenderFSAASamples = gSavedSettings.getU32("RenderFSAASamples");
+ RenderFSAASamples = LLFeatureManager::getInstance()->isFeatureAvailable("RenderFSAASamples") ? gSavedSettings.getU32("RenderFSAASamples") : 0;
RenderResolutionDivisor = gSavedSettings.getU32("RenderResolutionDivisor");
RenderUIBuffer = gSavedSettings.getBOOL("RenderUIBuffer");
RenderShadowDetail = gSavedSettings.getS32("RenderShadowDetail");
@@ -7010,9 +7010,19 @@ void LLPipeline::generateExposure(LLRenderTarget* src, LLRenderTarget* dst) {
static LLCachedControl<F32> dynamic_exposure_min(gSavedSettings, "RenderDynamicExposureMin", 0.125f);
static LLCachedControl<F32> dynamic_exposure_max(gSavedSettings, "RenderDynamicExposureMax", 1.3f);
+ F32 exposure_max = dynamic_exposure_max;
+ LLSettingsSky::ptr_t sky = LLEnvironment::instance().getCurrentSky();
+
+ if (sky->getReflectionProbeAmbiance() > 0.f)
+ { //not a legacy sky, use gamma as a boost to max exposure
+ exposure_max = llmax(exposure_max - 1.f, 0.f);
+ exposure_max *= sky->getGamma();
+ exposure_max += 1.f;
+ }
+
gExposureProgram.uniform1f(dt, gFrameIntervalSeconds);
gExposureProgram.uniform2f(noiseVec, ll_frand() * 2.0 - 1.0, ll_frand() * 2.0 - 1.0);
- gExposureProgram.uniform3f(dynamic_exposure_params, dynamic_exposure_coefficient, dynamic_exposure_min, dynamic_exposure_max);
+ gExposureProgram.uniform3f(dynamic_exposure_params, dynamic_exposure_coefficient, dynamic_exposure_min, exposure_max);
mScreenTriangleVB->setBuffer();
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
@@ -7029,18 +7039,25 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) {
{
LL_PROFILE_GPU_ZONE("gamma correct");
+ static LLCachedControl<bool> no_post(gSavedSettings, "RenderDisablePostProcessing", false);
+
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
// Apply gamma correction to the frame here.
- gDeferredPostGammaCorrectProgram.bind();
+
+ LLGLSLShader& shader = no_post && gFloaterTools->isAvailable() ? gNoPostGammaCorrectProgram : // no post (no gamma, no exposure, no tonemapping)
+ LLEnvironment::instance().getCurrentSky()->getReflectionProbeAmbiance() == 0.f ? gLegacyPostGammaCorrectProgram :
+ gDeferredPostGammaCorrectProgram;
+
+ shader.bind();
S32 channel = 0;
- gDeferredPostGammaCorrectProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_POINT);
+ shader.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, src, false, LLTexUnit::TFO_POINT);
- gDeferredPostGammaCorrectProgram.bindTexture(LLShaderMgr::EXPOSURE_MAP, &mExposureMap);
+ shader.bindTexture(LLShaderMgr::EXPOSURE_MAP, &mExposureMap);
- gDeferredPostGammaCorrectProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, src->getWidth(), src->getHeight());
+ shader.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, src->getWidth(), src->getHeight());
static LLCachedControl<F32> exposure(gSavedSettings, "RenderExposure", 1.f);
@@ -7048,13 +7065,13 @@ void LLPipeline::gammaCorrect(LLRenderTarget* src, LLRenderTarget* dst) {
static LLStaticHashedString s_exposure("exposure");
- gDeferredPostGammaCorrectProgram.uniform1f(s_exposure, e);
+ shader.uniform1f(s_exposure, e);
mScreenTriangleVB->setBuffer();
mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
gGL.getTexUnit(channel)->unbind(src->getUsage());
- gDeferredPostGammaCorrectProgram.unbind();
+ shader.unbind();
}
dst->flush();
}
diff --git a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml
index ca5c7fe264..aef923feb2 100644
--- a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml
+++ b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml
@@ -239,7 +239,7 @@
layout="topleft"
left_delta="-5"
top_pad="15"
- width="80">Scene Gamma:</text>
+ width="80">Brightness:</text>
<slider decimal_digits="2"
follows="left|top"
height="16"
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 255797a733..df067d2b88 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -1501,7 +1501,28 @@ function="World.EnvPreset"
function="ToggleControl"
parameter="ShowSelectionBeam" />
</menu_item_check>
-
+ <menu_item_check
+ label="Highlight Transparent"
+ name="Highlight Transparent"
+ shortcut="control|alt|T"
+ use_mac_ctrl="true">
+ <menu_item_check.on_check
+ function="View.CheckHighlightTransparent" />
+ <menu_item_check.on_click
+ function="View.HighlightTransparent" />
+ </menu_item_check>
+ <menu_item_separator/>
+
+ <menu_item_check
+ label="No Post"
+ name="No Post">
+ <menu_item_check.on_check
+ control="RenderDisablePostProcessing" />
+ <menu_item_check.on_click
+ function="ToggleControl"
+ parameter="RenderDisablePostProcessing" />
+ </menu_item_check>
+
<menu_item_separator/>
<menu_item_check
@@ -1911,16 +1932,6 @@ function="World.EnvPreset"
parameter="HideSelectedObjects" />
</menu_item_check>
<menu_item_check
- label="Highlight Transparent"
- name="Highlight Transparent"
- shortcut="control|alt|T"
- use_mac_ctrl="true">
- <menu_item_check.on_check
- function="View.CheckHighlightTransparent" />
- <menu_item_check.on_click
- function="View.HighlightTransparent" />
- </menu_item_check>
- <menu_item_check
label="Show Mouselook Crosshairs"
name="ShowCrosshairs">
<menu_item_check.on_check
diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml
index 622c999254..e90e6caf84 100644
--- a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml
+++ b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml
@@ -223,7 +223,7 @@
left_delta="-5"
top_delta="25"
width="80">
- Scene Gamma:
+ Brightness:
</text>
<slider
decimal_digits="2"