From 6162b9208a087f78eba609d3fe9da5c8385f7ade Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 30 Mar 2023 10:41:04 -0500 Subject: DRTVWR-559 Add RenderAutomaticReflectionProbes control. Tweak automatic exposure. --- indra/newview/app_settings/settings.xml | 11 +++-- .../shaders/class1/deferred/exposureF.glsl | 4 +- .../class1/deferred/postDeferredGammaCorrect.glsl | 1 - indra/newview/llreflectionmapmanager.cpp | 27 ++++------- indra/newview/llviewerregion.cpp | 52 +++++++++++----------- 5 files changed, 43 insertions(+), 52 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d6af39f97e..5ffd610fba 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10367,7 +10367,7 @@ Type U32 Value - 1 + 2 RenderExposure @@ -10403,18 +10403,17 @@ Value 0 - RenderReflectionProbeTextureHackID + RenderAutomaticReflectionProbes Comment - HACK -- Any object with a diffuse texture with this ID will be treated as a user override reflection probe. (default is "Violet Info Hub" photo from Library) + Automatic reflection probes control. 0 - disable, 1 - Terrain/water only, 2- Terrain/water + objects. Requires restart. Persist 1 Type - String + S32 Value - 6b186931-05da-eafa-a3ed-a012a33bbfb6 + 2 - RenderReflectionRes Comment diff --git a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl index ff37f9e4b3..b325f55576 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl @@ -46,7 +46,7 @@ float lum(vec3 col) void main() { - float step = 1.0/32.0; + float step = 1.0/16.0; float start = step; float end = 1.0-step; @@ -82,7 +82,7 @@ void main() float L = lum(col); - float s = clamp(0.1/L, 0.5, 2.0); + float s = clamp(0.1/L, 0.5, 2.5); float prev = texture(exposureMap, vec2(0.5,0.5)).r; s = mix(prev, s, min(dt*2.0, 0.04)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index 4ac1ff9368..221de0b095 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -125,7 +125,6 @@ vec3 toneMap(vec3 color) // this factor is based on the exposure correction of Krzysztof Narkowicz in his // implemetation of ACES tone mapping color *= 1.0/0.6; - //color /= 0.6; color = toneMapACES_Hill(color); #endif diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 58ce571505..6828078f4f 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -328,29 +328,20 @@ void LLReflectionMapManager::getReflectionMaps(std::vector& ma LLReflectionMap* LLReflectionMapManager::registerSpatialGroup(LLSpatialGroup* group) { -#if 1 - if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) + static LLCachedControl automatic_probes(gSavedSettings, "RenderAutomaticReflectionProbes", 2); + if (automatic_probes > 1) { - OctreeNode* node = group->getOctreeNode(); - F32 size = node->getSize().getF32ptr()[0]; - if (size >= 15.f && size <= 17.f) + if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) { - return addProbe(group); + OctreeNode* node = group->getOctreeNode(); + F32 size = node->getSize().getF32ptr()[0]; + if (size >= 15.f && size <= 17.f) + { + return addProbe(group); + } } } -#endif -#if 0 - if (group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_TERRAIN) - { - OctreeNode* node = group->getOctreeNode(); - F32 size = node->getSize().getF32ptr()[0]; - if (size >= 15.f && size <= 17.f) - { - return addProbe(group); - } - } -#endif return nullptr; } diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index dd4ff50259..192a96a408 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1255,43 +1255,45 @@ U32 LLViewerRegion::getNumOfVisibleGroups() const void LLViewerRegion::updateReflectionProbes() { -#if 1 - 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; + static LLCachedControl 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; - 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) - { - F32 x = i * probe_spacing + start; - for (U32 j = 0; j < grid_width; ++j) + for (U32 i = 0; i < grid_width; ++i) { - F32 y = j * probe_spacing + start; + F32 x = i * probe_spacing + start; + for (U32 j = 0; j < grid_width; ++j) + { + 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; + } } } -#endif } void LLViewerRegion::addToVOCacheTree(LLVOCacheEntry* entry) -- cgit v1.2.3