diff options
author | RunitaiLinden <davep@lindenlab.com> | 2023-04-18 19:11:38 -0500 |
---|---|---|
committer | RunitaiLinden <davep@lindenlab.com> | 2023-04-18 19:11:38 -0500 |
commit | 37eee397b70e2a13a1309025207d1c301f7070c5 (patch) | |
tree | 8f223d6719ce6bb57726e81b514f60c7d7a89359 /indra | |
parent | 04b6b84798c497582d8706368580eb3c3ce699eb (diff) |
DRTVWR-559 Add control for automatic reflection probes to advanced preferences and featuretable. Remove Reflections checkbox. Don't persist reflection probe volume display between sessions. Incidental decruft.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 19 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl | 4 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl | 15 | ||||
-rw-r--r-- | indra/newview/featuretable.txt | 10 | ||||
-rw-r--r-- | indra/newview/featuretable_mac.txt | 10 | ||||
-rw-r--r-- | indra/newview/llreflectionmap.cpp | 24 | ||||
-rw-r--r-- | indra/newview/llreflectionmap.h | 3 | ||||
-rw-r--r-- | indra/newview/llreflectionmapmanager.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llreflectionmapmanager.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewercontrol.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 51 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml | 62 |
13 files changed, 156 insertions, 75 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bc06a1f829..a057933009 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10197,7 +10197,7 @@ <key>Comment</key> <string>Render influence volumes of Reflection Probes</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> <string>Boolean</string> <key>Value</key> @@ -10392,16 +10392,27 @@ <key>Value</key> <real>0</real> </map> - <key>RenderAutomaticReflectionProbes</key> + <key>RenderDefaultProbeUpdatePeriod</key> <map> <key>Comment</key> - <string>Automatic reflection probes control. 0 - disable, 1 - Terrain/water only, 2- Terrain/water + objects. Requires restart.</string> + <string>When RenderReflectionProbeLevel is 0, amount of time in seconds to wait between updates to reflection map.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>F32</string> + <key>Value</key> + <real>20.0</real> + </map> + <key>RenderReflectionProbeLevel</key> + <map> + <key>Comment</key> + <string>Reflection probes control. 0 - disable (one probe to rule them all), 1 - manual probes only, 2 - manual + terrain/water, 3 - Manual + Terrain/water + objects.</string> <key>Persist</key> <integer>1</integer> <key>Type</key> <string>S32</string> <key>Value</key> - <integer>2</integer> + <integer>3</integer> </map> <key>RenderReflectionRes</key> <map> diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 55a43f76d0..36b5262104 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -122,6 +122,7 @@ bool shouldSampleProbe(int i, vec3 pos) // populate "probeIndex" with N probe indices that influence pos where N is REF_SAMPLE_COUNT void preProbeSample(vec3 pos) { +#if REFMAP_LEVEL > 0 // TODO: make some sort of structure that reduces the number of distance checks for (int i = 1; i < refmapCount; ++i) { @@ -213,6 +214,9 @@ void preProbeSample(vec3 pos) { // probe at index 0 is a special probe for smoothing out automatic probes probeIndex[probeInfluences++] = 0; } +#else + probeIndex[probeInfluences++] = 0; +#endif } // from https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index ab83708c7b..a8d61afeca 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -246,20 +246,6 @@ void main() vec3 refnormpersp = reflect(pos.xyz, norm.xyz); -#if 0 // wrong implementation - if (spec.a > 0.0) // specular reflection - { - float sa = dot(normalize(refnormpersp), light_dir.xyz); - vec3 dumbshiny = sunlit * scol * (texture2D(lightFunc, vec2(sa, spec.a)).r); - - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - color.rgb += spec_contrib; - - // add radiance map - applyGlossEnv(color, glossenv, spec, pos.xyz, norm.xyz); - } -#else //right implementation (ported from pointLightF.glsl) if (spec.a > 0.0) { vec3 lv = light_dir.xyz; @@ -284,7 +270,6 @@ void main() // add radiance map applyGlossEnv(color, glossenv, spec, pos.xyz, norm.xyz); } -#endif color.rgb = mix(color.rgb, baseColor.rgb, baseColor.a); diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 99007d52c2..78c2578cec 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 54 +version 55 // The version number above should be incremented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -62,6 +62,7 @@ Disregard96DefaultDrawDistance 1 1 RenderCompressTextures 1 1 RenderShaderLightingMaxLevel 1 3 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 RenderDeferred 1 1 RenderDeferredSSAO 1 1 RenderUseAdvancedAtmospherics 1 0 @@ -104,6 +105,7 @@ WLSkyDetail 1 96 RenderFSAASamples 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 8 +RenderReflectionProbeLevel 1 0 // // Medium Low Graphics Settings @@ -133,6 +135,7 @@ WLSkyDetail 1 96 RenderFSAASamples 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 16 +RenderReflectionProbeLevel 1 1 // // Medium Graphics Settings (standard) @@ -162,6 +165,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 32 +RenderReflectionProbeLevel 1 2 // // Medium High Graphics Settings (deferred enabled) @@ -191,6 +195,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 64 +RenderReflectionProbeLevel 1 2 // // High Graphics Settings (deferred + SSAO) @@ -220,6 +225,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 128 +RenderReflectionProbeLevel 1 3 // // High Ultra Graphics Settings (deferred + SSAO + shadows) @@ -249,6 +255,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Ultra graphics (REALLY PURTY!) @@ -278,6 +285,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 1 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Class Unknown Hardware (unknown) diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 24023901d9..1d407b52d8 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -1,4 +1,4 @@ -version 49 +version 50 // The version number above should be incremented IF AND ONLY IF some // change has been made that is sufficiently important to justify // resetting the graphics preferences of all users to the recommended @@ -73,6 +73,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 2 RenderScreenSpaceReflections 1 1 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Low Graphics Settings @@ -102,6 +103,7 @@ RenderReflectionsEnabled 1 0 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 8 +RenderReflectionProbeLevel 1 0 // // Medium Low Graphics Settings @@ -131,6 +133,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 16 +RenderReflectionProbeLevel 1 1 // // Medium Graphics Settings (standard) @@ -160,6 +163,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 32 +RenderReflectionProbeLevel 1 2 // // Medium High Graphics Settings (deferred enabled) @@ -189,6 +193,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 0 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 64 +RenderReflectionProbeLevel 1 2 // // High Graphics Settings (deferred + SSAO) @@ -218,6 +223,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 128 +RenderReflectionProbeLevel 1 3 // // High Ultra Graphics Settings (deferred + SSAO + shadows) @@ -247,6 +253,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Ultra graphics (REALLY PURTY!) @@ -276,6 +283,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 1 RenderReflectionProbeCount 1 256 +RenderReflectionProbeLevel 1 3 // // Class Unknown Hardware (unknown) diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 624fbd1758..72dab0cba8 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -263,6 +263,30 @@ bool LLReflectionMap::isActive() return mCubeIndex != -1; } +bool LLReflectionMap::isRelevant() +{ + static LLCachedControl<S32> RenderReflectionProbeLevel(gSavedSettings, "RenderReflectionProbeLevel", 3); + + if (mViewerObject && RenderReflectionProbeLevel > 0) + { // not an automatic probe + return true; + } + + if (RenderReflectionProbeLevel == 3) + { // all automatics are relevant + return true; + } + + if (RenderReflectionProbeLevel == 2) + { // terrain and water only, ignore probes that have a group + return !mGroup; + } + + // no automatic probes, yes manual probes + return mViewerObject != nullptr; +} + + void LLReflectionMap::doOcclusion(const LLVector4a& eye) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; diff --git a/indra/newview/llreflectionmap.h b/indra/newview/llreflectionmap.h index d639f6a54c..803f7bdc97 100644 --- a/indra/newview/llreflectionmap.h +++ b/indra/newview/llreflectionmap.h @@ -72,6 +72,9 @@ public: // perform occlusion query/readback void doOcclusion(const LLVector4a& eye); + // return false if this probe isn't currently relevant (for example, disabled due to graphics preferences) + bool isRelevant(); + // point at which environment map was last generated from (in agent space) LLVector4a mOrigin; diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index ea2db63560..88edbc9224 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -173,6 +173,8 @@ void LLReflectionMapManager::update() bool did_update = false; static LLCachedControl<S32> sDetail(gSavedSettings, "RenderReflectionProbeDetail", -1); + static LLCachedControl<S32> sLevel(gSavedSettings, "RenderReflectionProbeLevel", 3); + bool realtime = sDetail >= (S32)LLReflectionMapManager::DetailLevel::REALTIME; LLReflectionMap* closestDynamic = nullptr; @@ -198,6 +200,11 @@ void LLReflectionMapManager::update() continue; } + if (probe != mDefaultProbe && !probe->isRelevant()) + { + continue; + } + probe->mProbeIndex = i; LLVector4a d; @@ -270,6 +277,13 @@ void LLReflectionMapManager::update() mRadiancePass = radiance_pass; } + static LLCachedControl<F32> sUpdatePeriod(gSavedSettings, "RenderDefaultProbeUpdatePeriod", 20.f); + if (sLevel == 0 && + gFrameTimeSeconds - mDefaultProbe->mLastUpdateTime < sUpdatePeriod) + { // when probes are disabled don't update the default probe more often than once every 20 seconds + oldestProbe = nullptr; + } + // switch to updating the next oldest probe if (!did_update && oldestProbe != nullptr) { @@ -360,17 +374,13 @@ void LLReflectionMapManager::getReflectionMaps(std::vector<LLReflectionMap*>& ma LLReflectionMap* LLReflectionMapManager::registerSpatialGroup(LLSpatialGroup* group) { - static LLCachedControl<S32> automatic_probes(gSavedSettings, "RenderAutomaticReflectionProbes", 2); - if (automatic_probes > 1) + if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) { - if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) + OctreeNode* node = group->getOctreeNode(); + F32 size = node->getSize().getF32ptr()[0]; + if (size >= 15.f && size <= 17.f) { - OctreeNode* node = group->getOctreeNode(); - F32 size = node->getSize().getF32ptr()[0]; - if (size >= 15.f && size <= 17.f) - { - return addProbe(group); - } + return addProbe(group); } } diff --git a/indra/newview/llreflectionmapmanager.h b/indra/newview/llreflectionmapmanager.h index 066b1e380f..234bde51a8 100644 --- a/indra/newview/llreflectionmapmanager.h +++ b/indra/newview/llreflectionmapmanager.h @@ -77,6 +77,7 @@ public: // presently hacked into LLViewerObject::setTE // Used by LLViewerObjects that are Reflection Probes + // vobj must not be null // Guaranteed to not return null LLReflectionMap* registerViewerObject(LLViewerObject* vobj); diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 8973d1c099..bbdae95b7f 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -420,6 +420,7 @@ static bool handleReflectionProbeDetailChanged(const LLSD& newvalue) gPipeline.releaseGLBuffers(); gPipeline.createGLBuffers(); LLViewerShaderMgr::instance()->setShaders(); + gPipeline.mReflectionMapManager.reset(); } return true; } @@ -652,6 +653,7 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderDeferredNoise", handleReleaseGLBufferChanged); setting_setup_signal_listener(gSavedSettings, "RenderDebugPipeline", handleRenderDebugPipelineChanged); setting_setup_signal_listener(gSavedSettings, "RenderResolutionDivisor", handleRenderResolutionDivisorChanged); + setting_setup_signal_listener(gSavedSettings, "RenderReflectionProbeLevel", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderReflectionProbeDetail", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderReflectionsEnabled", handleReflectionProbeDetailChanged); setting_setup_signal_listener(gSavedSettings, "RenderScreenSpaceReflections", handleReflectionProbeDetailChanged); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d3ee6daa6f..402d03bc6e 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1255,43 +1255,40 @@ U32 LLViewerRegion::getNumOfVisibleGroups() const void LLViewerRegion::updateReflectionProbes() { - static LLCachedControl<S32> automatic_probes(gSavedSettings, "RenderAutomaticReflectionProbes", 2); - if (automatic_probes > 0) - { - const F32 probe_spacing = 32.f; - const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); - const F32 hover_height = 2.f; + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + const F32 probe_spacing = 32.f; + const F32 probe_radius = sqrtf((probe_spacing * 0.5f) * (probe_spacing * 0.5f) * 3.f); + const F32 hover_height = 2.f; - F32 start = probe_spacing * 0.5f; + F32 start = probe_spacing * 0.5f; - U32 grid_width = REGION_WIDTH_METERS / probe_spacing; + U32 grid_width = REGION_WIDTH_METERS / probe_spacing; - mReflectionMaps.resize(grid_width * grid_width); + mReflectionMaps.resize(grid_width * grid_width); - F32 water_height = getWaterHeight(); - LLVector3 origin = getOriginAgent(); + F32 water_height = getWaterHeight(); + LLVector3 origin = getOriginAgent(); - for (U32 i = 0; i < grid_width; ++i) + for (U32 i = 0; i < grid_width; ++i) + { + F32 x = i * probe_spacing + start; + for (U32 j = 0; j < grid_width; ++j) { - F32 x = i * probe_spacing + start; - for (U32 j = 0; j < grid_width; ++j) - { - F32 y = j * probe_spacing + start; + F32 y = j * probe_spacing + start; - U32 idx = i * grid_width + j; + U32 idx = i * grid_width + j; - if (mReflectionMaps[idx].isNull()) - { - mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe(); - } + if (mReflectionMaps[idx].isNull()) + { + mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe(); + } - LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y))); - probe_origin.mV[2] += hover_height; - probe_origin += origin; + LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y))); + probe_origin.mV[2] += hover_height; + probe_origin += origin; - mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); - mReflectionMaps[idx]->mRadius = probe_radius; - } + mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV); + mReflectionMaps[idx]->mRadius = probe_radius; } } } diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 1fd536ceac..f51f35ba9a 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -658,6 +658,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() bool has_reflection_probes = gSavedSettings.getBOOL("RenderReflectionsEnabled") && gGLManager.mGLVersion > 3.99f; S32 probe_count = llclamp(gSavedSettings.getS32("RenderReflectionProbeCount"), 1, LL_MAX_REFLECTION_PROBE_COUNT); + S32 probe_level = llclamp(gSavedSettings.getS32("RenderReflectionProbeLevel"), 0, 3); if (ambient_kill) { @@ -694,6 +695,7 @@ std::string LLViewerShaderMgr::loadBasicShaders() if (has_reflection_probes) { attribs["REFMAP_COUNT"] = std::to_string(probe_count); + attribs["REFMAP_LEVEL"] = std::to_string(probe_level); attribs["REF_SAMPLE_COUNT"] = "32"; } 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 16b965843d..d867123c4b 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 @@ -649,26 +649,12 @@ </combo_box> <check_box - control_name="RenderReflectionsEnabled" - height="16" - initial_value="true" - label="Reflections" - layout="topleft" - left="420" - name="ReflectionsEnabled" - top_delta="16" - width="240"> - <check_box.commit_callback - function="Pref.RenderOptionUpdate" /> - </check_box> - - <check_box control_name="RenderScreenSpaceReflections" height="16" initial_value="true" label="Screen Space Reflections" layout="topleft" - left="440" + left="420" name="ScreenSpaceReflections" top_delta="16" width="240"> @@ -682,7 +668,7 @@ follows="left|top" height="16" layout="topleft" - left="440" + left="420" name="ReflectionDetailText" text_readonly_color="LabelDisabledColor" top_delta="16" @@ -694,7 +680,7 @@ control_name="RenderReflectionProbeDetail" height="18" layout="topleft" - left_delta="110" + left_delta="130" top_delta="0" name="ReflectionDetail" width="150"> @@ -712,7 +698,47 @@ value="2"/> </combo_box> - <slider + <text + type="string" + length="1" + follows="left|top" + height="16" + layout="topleft" + left="420" + name="ReflectionProbeText" + text_readonly_color="LabelDisabledColor" + top_delta="16" + width="128"> + Reflection Coverage: + </text> + + <combo_box + control_name="RenderReflectionProbeLevel" + height="18" + layout="topleft" + left_delta="130" + top_delta="0" + name="ReflectionLevel" + width="150"> + <combo_box.item + label="None" + name="0" + value="0"/> + <combo_box.item + label="Manual only" + name="1" + value="1"/> + <combo_box.item + label="Manual + terrain and water" + name="2" + value="2"/> + <combo_box.item + label="Full scene" + name="3" + value="3"/> + </combo_box> + + <slider control_name="RenderExposure" decimal_digits="1" follows="left|top" |