diff options
-rw-r--r-- | indra/newview/app_settings/settings.xml | 28 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl | 7 | ||||
-rw-r--r-- | indra/newview/llviewercontrol.cpp | 1 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 10 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 8 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml | 55 |
6 files changed, 99 insertions, 10 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5217e88a59..81fed560bb 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10402,9 +10402,31 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <integer>8</integer> + <real>8</real> </map> - + <key>RenderTonemapper</key> + <map> + <key>Comment</key> + <string>Which tone mapping function to use (0 - Linear, 1 - ACES Narkowicz, 2 - ACES Hill)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <real>1</real> + </map> + <key>RenderExposure</key> + <map> + <key>Comment</key> + <string>Exposure value to send to tonemapper.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>1</real> + </map> + <key>RenderReflectionProbeDrawDistance</key> <map> <key>Comment</key> @@ -10414,7 +10436,7 @@ <key>Type</key> <string>F32</string> <key>Value</key> - <real>64</real> + <integer>64</integer> </map> <key>RenderReflectionProbeAmbiance</key> <map> diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index e0e975faf0..f0e940eb5f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -127,14 +127,11 @@ vec3 toneMapACES_Hill(vec3 color) return color; } - -#define TONEMAP_ACES_NARKOWICZ -//#define TONEMAP_ACES_HILL_EXPOSURE_BOOST -float u_Exposure = 1; +uniform float exposure; vec3 toneMap(vec3 color) { - color *= u_Exposure; + color *= exposure; #ifdef TONEMAP_ACES_NARKOWICZ color = toneMapACES_Narkowicz(color); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 341f94241a..ea53012b7a 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -681,6 +681,7 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderReflectionsEnabled", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderScreenSpaceReflections", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderShadowDetail", handleSetShaderChanged); + setting_setup_signal_listener(gSavedSettings, "RenderTonemapper", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderDeferredSSAO", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderPerformanceTest", handleRenderPerfTestChanged); setting_setup_signal_listener(gSavedSettings, "ChatFontSize", handleChatFontSizeChanged); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 584dc5c344..859df1277c 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2518,6 +2518,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredPostGammaCorrectProgram.mFeatures.hasSrgb = true; gDeferredPostGammaCorrectProgram.mFeatures.isDeferred = true; gDeferredPostGammaCorrectProgram.mShaderFiles.clear(); + gDeferredPostGammaCorrectProgram.clearPermutations(); + U32 tonemapper = gSavedSettings.getU32("RenderTonemapper"); + if (tonemapper == 1) + { + gDeferredPostGammaCorrectProgram.addPermutation("TONEMAP_ACES_NARKOWICZ", "1"); + } + else if (tonemapper == 2) + { + gDeferredPostGammaCorrectProgram.addPermutation("TONEMAP_ACES_HILL_EXPOSURE_BOOST", "1"); + } gDeferredPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER)); gDeferredPostGammaCorrectProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredGammaCorrect.glsl", GL_FRAGMENT_SHADER)); gDeferredPostGammaCorrectProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED]; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8d9a2a876e..9522f804d6 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7575,9 +7575,13 @@ void LLPipeline::renderFinalize() gDeferredPostGammaCorrectProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, screenTarget()->getWidth(), screenTarget()->getHeight()); - F32 gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma"); + static LLCachedControl<F32> exposure(gSavedSettings, "RenderExposure", 1.f); - gDeferredPostGammaCorrectProgram.uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f / 2.2f)); + F32 e = llclamp(exposure(), 0.5f, 4.f); + + static LLStaticHashedString s_exposure("exposure"); + + gDeferredPostGammaCorrectProgram.uniform1f(s_exposure, e); mScreenTriangleVB->setBuffer(); mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml index 7f03fbe7c3..a08831b396 100644 --- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml +++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml @@ -712,6 +712,61 @@ value="2"/> </combo_box> + + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="420" + name="RenderTonemapperText" + text_readonly_color="LabelDisabledColor" + top_delta="24" + width="128"> + Tonemapper: + </text> + <combo_box + control_name="RenderTonemapper" + height="18" + layout="topleft" + left_delta="130" + top_delta="0" + name="ToneMapper" + width="150"> + <combo_box.item + label="Linear" + name="0" + value="0"/> + <combo_box.item + label="ACES Narkowicz" + name="1" + value="1"/> + <combo_box.item + label="ACES Hill" + name="2" + value="2"/> + </combo_box> + + <slider + control_name="RenderExposure" + decimal_digits="1" + follows="left|top" + height="16" + increment="0.1" + initial_value="160" + label="Exposure:" + label_width="145" + layout="topleft" + left="420" + min_val="0.5" + max_val="4.0" + name="RenderExposure" + show_text="true" + top_delta="20" + width="260"> + </slider> + <!-- End of Advanced Settings block --> <view_border bevel_style="in" |