From 93260cfeff2382dd1ffeecaef208d37bf21c2a01 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 4 May 2022 16:07:50 +0000 Subject: SL-17283 LLReflectionMapManager prototype. Remove snapshot code related overhead from reflection map renders. Add parallax correction and support for multiple reflection maps. --- indra/newview/llreflectionmap.cpp | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 indra/newview/llreflectionmap.cpp (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp new file mode 100644 index 0000000000..b75dba877e --- /dev/null +++ b/indra/newview/llreflectionmap.cpp @@ -0,0 +1,64 @@ +/** + * @file llreflectionmap.cpp + * @brief LLReflectionMap class implementation + * + * $LicenseInfo:firstyear=2022&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2022, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llreflectionmap.h" +#include "pipeline.h" +#include "llviewerwindow.h" + +LLReflectionMap::LLReflectionMap() +{ +} + +void LLReflectionMap::update(const LLVector3& origin, U32 resolution) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + llassert(LLPipeline::sRenderDeferred); + + // make sure resolution is < gPipeline.mDeferredScreen.getWidth() + + while (resolution > gPipeline.mDeferredScreen.getWidth() || + resolution > gPipeline.mDeferredScreen.getHeight()) + { + resolution /= 2; + } + + if (resolution == 0) + { + return; + } + + mOrigin.load3(origin.mV); + + mCubeMap = new LLCubeMap(false); + mCubeMap->initReflectionMap(resolution); + + gViewerWindow->cubeSnapshot(origin, mCubeMap); + + mCubeMap->generateMipMaps(); +} + -- cgit v1.2.3 From 3400e5fd302c0d9dea6386c4d5bf38876f2cc287 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 16 May 2022 17:21:08 +0000 Subject: SL-17284 Reflection probe tuning and optimization take 1 --- indra/newview/llreflectionmap.cpp | 171 +++++++++++++++++++++++++++++++++++--- 1 file changed, 159 insertions(+), 12 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index b75dba877e..0cf2f22822 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -29,36 +29,183 @@ #include "llreflectionmap.h" #include "pipeline.h" #include "llviewerwindow.h" +#include "llviewerregion.h" + +extern F32SecondsImplicit gFrameTimeSeconds; LLReflectionMap::LLReflectionMap() { + mLastUpdateTime = gFrameTimeSeconds; } -void LLReflectionMap::update(const LLVector3& origin, U32 resolution) +void LLReflectionMap::update(U32 resolution, U32 face) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + mLastUpdateTime = gFrameTimeSeconds; + llassert(mCubeArray.notNull()); + llassert(mCubeIndex != -1); llassert(LLPipeline::sRenderDeferred); - - // make sure resolution is < gPipeline.mDeferredScreen.getWidth() - + + // make sure we don't walk off the edge of the render target while (resolution > gPipeline.mDeferredScreen.getWidth() || resolution > gPipeline.mDeferredScreen.getHeight()) { resolution /= 2; } + gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face); +} - if (resolution == 0) - { - return; +bool LLReflectionMap::shouldUpdate() +{ + const F32 UPDATE_INTERVAL = 10.f; // update no more than this often + const F32 TIMEOUT_INTERVAL = 30.f; // update no less than this often + const F32 RENDER_TIMEOUT = 1.f; // don't update if hasn't been used for rendering for this long + + if (mLastBindTime > gFrameTimeSeconds - RENDER_TIMEOUT) + { + if (mDirty && mLastUpdateTime < gFrameTimeSeconds - UPDATE_INTERVAL) + { + return true; + } + + if (mLastUpdateTime < gFrameTimeSeconds - TIMEOUT_INTERVAL) + { + return true; + } } - mOrigin.load3(origin.mV); + return false; +} + +void LLReflectionMap::dirty() +{ + mDirty = true; + mLastUpdateTime = gFrameTimeSeconds; +} + +void LLReflectionMap::autoAdjustOrigin() +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + + if (mGroup) + { + const LLVector4a* bounds = mGroup->getBounds(); + auto* node = mGroup->getOctreeNode(); + + if (mGroup->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_TERRAIN) + { + // for terrain, make probes float a couple meters above the highest point in the surface patch + mOrigin = bounds[0]; + mOrigin.getF32ptr()[2] += bounds[1].getF32ptr()[2] + 3.f; + + // update radius to encompass bounding box + LLVector4a d; + d.setAdd(bounds[0], bounds[1]); + d.sub(mOrigin); + mRadius = d.getLength3().getF32(); + } + else if (mGroup->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) + { + // cast a ray towards 8 corners of bounding box + // nudge origin towards center of empty space + + if (node->isLeaf() || node->getChildCount() > 1 || node->getData().size() > 0) + { // use center of object bounding box for leaf nodes or nodes with multiple child nodes + mOrigin = bounds[0]; - mCubeMap = new LLCubeMap(false); - mCubeMap->initReflectionMap(resolution); + LLVector4a start; + LLVector4a end; - gViewerWindow->cubeSnapshot(origin, mCubeMap); + LLVector4a size = bounds[1]; - mCubeMap->generateMipMaps(); + LLVector4a corners[] = + { + { 1, 1, 1 }, + { -1, 1, 1 }, + { 1, -1, 1 }, + { -1, -1, 1 }, + { 1, 1, -1 }, + { -1, 1, -1 }, + { 1, -1, -1 }, + { -1, -1, -1 } + }; + + for (int i = 0; i < 8; ++i) + { + corners[i].mul(size); + corners[i].add(bounds[0]); + } + + LLVector4a extents[2]; + extents[0].setAdd(bounds[0], bounds[1]); + extents[1].setSub(bounds[0], bounds[1]); + + bool hit = false; + for (int i = 0; i < 8; ++i) + { + int face = -1; + LLVector4a intersection; + LLDrawable* drawable = mGroup->lineSegmentIntersect(bounds[0], corners[i], true, false, &face, &intersection); + if (drawable != nullptr) + { + hit = true; + update_min_max(extents[0], extents[1], intersection); + } + else + { + update_min_max(extents[0], extents[1], corners[i]); + } + } + + if (hit) + { + mOrigin.setAdd(extents[0], extents[1]); + mOrigin.mul(0.5f); + } + + // make sure radius encompasses all objects + LLSimdScalar r2 = 0.0; + for (int i = 0; i < 8; ++i) + { + LLVector4a v; + v.setSub(corners[i], mOrigin); + + LLSimdScalar d = v.dot3(v); + + if (d > r2) + { + r2 = d; + } + } + + mRadius = llmax(sqrtf(r2.getF32()), 8.f); + } + else + { + // use center of octree node volume for nodes that are just branches without data + mOrigin = node->getCenter(); + + // update radius to encompass entire octree node volume + mRadius = node->getSize().getLength3().getF32(); + + //mOrigin = bounds[0]; + //mRadius = bounds[1].getLength3().getF32(); + + } + } + } } +bool LLReflectionMap::intersects(LLReflectionMap* other) +{ + LLVector4a delta; + delta.setSub(other->mOrigin, mOrigin); + + F32 dist = delta.dot3(delta).getF32(); + + F32 r2 = mRadius + other->mRadius; + + r2 *= r2; + + return dist < r2; +} -- cgit v1.2.3 From 53c692c9597551c9a1ba8eee346432de51d9d22d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 17 May 2022 14:32:07 -0500 Subject: SL-17416 Quick 'n dirty reflection probe override hack. --- indra/newview/llreflectionmap.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 0cf2f22822..c146a888cf 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -194,6 +194,11 @@ void LLReflectionMap::autoAdjustOrigin() } } } + else if (mViewerObject) + { + mOrigin.load3(mViewerObject->getPositionAgent().mV); + mRadius = mViewerObject->getScale().mV[0]; + } } bool LLReflectionMap::intersects(LLReflectionMap* other) -- cgit v1.2.3 From 63878a60eb8ab6884ed3aeec63a28e5089636092 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 18 May 2022 23:09:57 -0500 Subject: SL-17416 Box reflection probe influence volumes --- indra/newview/llreflectionmap.cpp | 61 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index c146a888cf..4ac2803208 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -106,6 +106,7 @@ void LLReflectionMap::autoAdjustOrigin() } else if (mGroup->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) { + mPriority = 8; // cast a ray towards 8 corners of bounding box // nudge origin towards center of empty space @@ -182,6 +183,9 @@ void LLReflectionMap::autoAdjustOrigin() } else { + // user placed probe + mPriority = 64; + // use center of octree node volume for nodes that are just branches without data mOrigin = node->getCenter(); @@ -196,13 +200,15 @@ void LLReflectionMap::autoAdjustOrigin() } else if (mViewerObject) { + mPriority = 64; mOrigin.load3(mViewerObject->getPositionAgent().mV); - mRadius = mViewerObject->getScale().mV[0]; + mRadius = mViewerObject->getScale().mV[0]*0.5f; } } bool LLReflectionMap::intersects(LLReflectionMap* other) { + // TODO: incorporate getBox LLVector4a delta; delta.setSub(other->mOrigin, mOrigin); @@ -214,3 +220,56 @@ bool LLReflectionMap::intersects(LLReflectionMap* other) return dist < r2; } + +bool LLReflectionMap::getBox(LLMatrix4& box) +{ + if (mViewerObject) + { + LLVolume* volume = mViewerObject->getVolume(); + if (volume) + { + LLVOVolume* vobjp = (LLVOVolume*)mViewerObject; + + U8 profile = volume->getProfileType(); + U8 path = volume->getPathType(); + + if (profile == LL_PCODE_PROFILE_SQUARE && + path == LL_PCODE_PATH_LINE) + { + // nope + /*box = vobjp->getRelativeXform(); + box *= vobjp->mDrawable->getRenderMatrix(); + LLMatrix4 modelview(gGLModelView); + box *= modelview; + box.invert();*/ + + // nope + /*box = LLMatrix4(gGLModelView); + box *= vobjp->mDrawable->getRenderMatrix(); + box *= vobjp->getRelativeXform(); + box.invert();*/ + + glh::matrix4f mv(gGLModelView); + glh::matrix4f scale; + LLVector3 s = vobjp->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f)); + mRadius = s.magVec(); + scale.set_scale(glh::vec3f(s.mV)); + if (vobjp->mDrawable != nullptr) + { + glh::matrix4f rm((F32*)vobjp->mDrawable->getWorldMatrix().mMatrix); + + glh::matrix4f rt((F32*)vobjp->getRelativeXform().mMatrix); + + mv = mv * rm * scale; // *rt; + mv = mv.inverse(); + + box = LLMatrix4(mv.m); + + return true; + } + } + } + } + + return false; +} -- cgit v1.2.3 From 6eaf8521abae0deeb1162f9c61747183110176b0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 20 May 2022 19:05:28 -0500 Subject: SL-17287 Instrument and optimize cubemap render. Fix for cubemap snapshots doing a full resolution render instead of a 512x512 render. --- indra/newview/llreflectionmap.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 4ac2803208..54a627efd4 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -47,8 +47,8 @@ void LLReflectionMap::update(U32 resolution, U32 face) llassert(LLPipeline::sRenderDeferred); // make sure we don't walk off the edge of the render target - while (resolution > gPipeline.mDeferredScreen.getWidth() || - resolution > gPipeline.mDeferredScreen.getHeight()) + while (resolution > gPipeline.mRT->deferredScreen.getWidth() || + resolution > gPipeline.mRT->deferredScreen.getHeight()) { resolution /= 2; } @@ -57,17 +57,11 @@ void LLReflectionMap::update(U32 resolution, U32 face) bool LLReflectionMap::shouldUpdate() { - const F32 UPDATE_INTERVAL = 10.f; // update no more than this often const F32 TIMEOUT_INTERVAL = 30.f; // update no less than this often const F32 RENDER_TIMEOUT = 1.f; // don't update if hasn't been used for rendering for this long if (mLastBindTime > gFrameTimeSeconds - RENDER_TIMEOUT) { - if (mDirty && mLastUpdateTime < gFrameTimeSeconds - UPDATE_INTERVAL) - { - return true; - } - if (mLastUpdateTime < gFrameTimeSeconds - TIMEOUT_INTERVAL) { return true; -- cgit v1.2.3 From 220afbcda0961df86ad08bbd51d96b8c868b2e62 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 2 Jun 2022 18:42:38 -0500 Subject: SL-17285 Add proper reflection probe support to LLVOVolume, LLPrimitive, and LLPanelVolume --- indra/newview/llreflectionmap.cpp | 51 ++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 54a627efd4..f8a2020ccb 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -35,7 +35,6 @@ extern F32SecondsImplicit gFrameTimeSeconds; LLReflectionMap::LLReflectionMap() { - mLastUpdateTime = gFrameTimeSeconds; } void LLReflectionMap::update(U32 resolution, U32 face) @@ -52,7 +51,7 @@ void LLReflectionMap::update(U32 resolution, U32 face) { resolution /= 2; } - gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face); + gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, getNearClip()); } bool LLReflectionMap::shouldUpdate() @@ -215,6 +214,35 @@ bool LLReflectionMap::intersects(LLReflectionMap* other) return dist < r2; } +extern LLControlGroup gSavedSettings; + +F32 LLReflectionMap::getAmbiance() +{ + static LLCachedControl minimum_ambiance(gSavedSettings, "RenderReflectionProbeAmbiance", 0.f); + + F32 ret = 0.f; + if (mViewerObject && mViewerObject->getVolume()) + { + ret = ((LLVOVolume*)mViewerObject)->getReflectionProbeAmbiance(); + } + + return llmax(ret, minimum_ambiance()); +} + +F32 LLReflectionMap::getNearClip() +{ + const F32 MINIMUM_NEAR_CLIP = 0.1f; + + F32 ret = 0.f; + + if (mViewerObject && mViewerObject->getVolume()) + { + ret = ((LLVOVolume*)mViewerObject)->getReflectionProbeNearClip(); + } + + return llmax(ret, MINIMUM_NEAR_CLIP); +} + bool LLReflectionMap::getBox(LLMatrix4& box) { if (mViewerObject) @@ -224,25 +252,8 @@ bool LLReflectionMap::getBox(LLMatrix4& box) { LLVOVolume* vobjp = (LLVOVolume*)mViewerObject; - U8 profile = volume->getProfileType(); - U8 path = volume->getPathType(); - - if (profile == LL_PCODE_PROFILE_SQUARE && - path == LL_PCODE_PATH_LINE) + if (vobjp->getReflectionProbeVolumeType() == LLReflectionProbeParams::VOLUME_TYPE_BOX) { - // nope - /*box = vobjp->getRelativeXform(); - box *= vobjp->mDrawable->getRenderMatrix(); - LLMatrix4 modelview(gGLModelView); - box *= modelview; - box.invert();*/ - - // nope - /*box = LLMatrix4(gGLModelView); - box *= vobjp->mDrawable->getRenderMatrix(); - box *= vobjp->getRelativeXform(); - box.invert();*/ - glh::matrix4f mv(gGLModelView); glh::matrix4f scale; LLVector3 s = vobjp->getScale().scaledVec(LLVector3(0.5f, 0.5f, 0.5f)); -- cgit v1.2.3 From 0d9c23372bf8b34387b7d9de89234d3e9a5fd879 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 9 Jun 2022 14:09:33 -0500 Subject: SL-17551 Add "Select Reflection Probes" menu option and make invisible objects less annoying when alt-zooming in edit mode. --- indra/newview/llreflectionmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index f8a2020ccb..5991d7a170 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -139,7 +139,7 @@ void LLReflectionMap::autoAdjustOrigin() { int face = -1; LLVector4a intersection; - LLDrawable* drawable = mGroup->lineSegmentIntersect(bounds[0], corners[i], true, false, &face, &intersection); + LLDrawable* drawable = mGroup->lineSegmentIntersect(bounds[0], corners[i], true, false, true, &face, &intersection); if (drawable != nullptr) { hit = true; -- cgit v1.2.3 From 03d85bfb33f53e658256d8bedcf0b4262226cf90 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 9 Jun 2022 19:43:21 -0500 Subject: SL-17573 Add "dynamic" checkbox, also followup on SL-17551 and do "Select Invisible Objects" checkbox instead of "Select Reflection Probes" --- indra/newview/llreflectionmap.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 5991d7a170..39e0841fc5 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -51,7 +51,7 @@ void LLReflectionMap::update(U32 resolution, U32 face) { resolution /= 2; } - gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, getNearClip()); + gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, getNearClip(), getIsDynamic()); } bool LLReflectionMap::shouldUpdate() @@ -243,6 +243,16 @@ F32 LLReflectionMap::getNearClip() return llmax(ret, MINIMUM_NEAR_CLIP); } +bool LLReflectionMap::getIsDynamic() +{ + if (mViewerObject && mViewerObject->getVolume()) + { + return ((LLVOVolume*)mViewerObject)->getReflectionProbeIsDynamic(); + } + + return false; +} + bool LLReflectionMap::getBox(LLMatrix4& box) { if (mViewerObject) @@ -252,7 +262,7 @@ bool LLReflectionMap::getBox(LLMatrix4& box) { LLVOVolume* vobjp = (LLVOVolume*)mViewerObject; - if (vobjp->getReflectionProbeVolumeType() == LLReflectionProbeParams::VOLUME_TYPE_BOX) + if (vobjp->getReflectionProbeIsBox()) { glh::matrix4f mv(gGLModelView); glh::matrix4f scale; -- cgit v1.2.3 From 509476f95ed75ce8289ecd69b4c94d9912e1d3df Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Jun 2022 01:13:41 -0500 Subject: SL-17574 Add probe detail combo box to advanced graphics preferences. Fix spot light shadows not working in probes. --- indra/newview/llreflectionmap.cpp | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 39e0841fc5..500485fc70 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -54,28 +54,6 @@ void LLReflectionMap::update(U32 resolution, U32 face) gViewerWindow->cubeSnapshot(LLVector3(mOrigin), mCubeArray, mCubeIndex, face, getNearClip(), getIsDynamic()); } -bool LLReflectionMap::shouldUpdate() -{ - const F32 TIMEOUT_INTERVAL = 30.f; // update no less than this often - const F32 RENDER_TIMEOUT = 1.f; // don't update if hasn't been used for rendering for this long - - if (mLastBindTime > gFrameTimeSeconds - RENDER_TIMEOUT) - { - if (mLastUpdateTime < gFrameTimeSeconds - TIMEOUT_INTERVAL) - { - return true; - } - } - - return false; -} - -void LLReflectionMap::dirty() -{ - mDirty = true; - mLastUpdateTime = gFrameTimeSeconds; -} - void LLReflectionMap::autoAdjustOrigin() { LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; @@ -245,7 +223,9 @@ F32 LLReflectionMap::getNearClip() bool LLReflectionMap::getIsDynamic() { - if (mViewerObject && mViewerObject->getVolume()) + if (gSavedSettings.getS32("RenderReflectionProbeDetail") > (S32) LLReflectionMapManager::DetailLevel::STATIC_ONLY && + mViewerObject && + mViewerObject->getVolume()) { return ((LLVOVolume*)mViewerObject)->getReflectionProbeIsDynamic(); } -- cgit v1.2.3 From 929abcd296199ab4ed7a0b08166e284502f7b8df Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Jun 2022 16:36:38 -0500 Subject: SL-17523 Add reflection probe ambiance to windlight settings and integrate with UI and ReflectionMapManager --- indra/newview/llreflectionmap.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 500485fc70..4d4eb802f1 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -196,15 +196,13 @@ extern LLControlGroup gSavedSettings; F32 LLReflectionMap::getAmbiance() { - static LLCachedControl minimum_ambiance(gSavedSettings, "RenderReflectionProbeAmbiance", 0.f); - F32 ret = 0.f; if (mViewerObject && mViewerObject->getVolume()) { ret = ((LLVOVolume*)mViewerObject)->getReflectionProbeAmbiance(); } - return llmax(ret, minimum_ambiance()); + return ret; } F32 LLReflectionMap::getNearClip() -- cgit v1.2.3 From 8b4347cb10ab922f5001306912983cdd73a68309 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 21 Jun 2022 11:58:58 -0500 Subject: SL-17600 Revise reflection probe priorities --- indra/newview/llreflectionmap.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 4d4eb802f1..2a7ab84501 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -74,10 +74,11 @@ void LLReflectionMap::autoAdjustOrigin() d.setAdd(bounds[0], bounds[1]); d.sub(mOrigin); mRadius = d.getLength3().getF32(); + mPriority = 1; } else if (mGroup->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) { - mPriority = 8; + mPriority = 1; // cast a ray towards 8 corners of bounding box // nudge origin towards center of empty space @@ -155,7 +156,7 @@ void LLReflectionMap::autoAdjustOrigin() else { // user placed probe - mPriority = 64; + mPriority = 2; // use center of octree node volume for nodes that are just branches without data mOrigin = node->getCenter(); -- cgit v1.2.3 From 5034c565bf627b4ecaac44376566212f432d97ff Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 14 Sep 2022 00:28:28 +0300 Subject: SL-18044 (PBR) No-copy textures not applying to objects --- indra/newview/llreflectionmap.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 2a7ab84501..d9dd1e9381 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -82,6 +82,11 @@ void LLReflectionMap::autoAdjustOrigin() // cast a ray towards 8 corners of bounding box // nudge origin towards center of empty space + if (!node) + { + return; + } + if (node->isLeaf() || node->getChildCount() > 1 || node->getData().size() > 0) { // use center of object bounding box for leaf nodes or nodes with multiple child nodes mOrigin = bounds[0]; -- cgit v1.2.3 From f887f65830c05d15517cbd8f15ca0e59210dfbee Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 28 Sep 2022 16:49:11 -0500 Subject: SL-18190 WIP - Linear space atmospherics take 2 --- indra/newview/llreflectionmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index d9dd1e9381..9bf1174742 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -43,7 +43,7 @@ void LLReflectionMap::update(U32 resolution, U32 face) mLastUpdateTime = gFrameTimeSeconds; llassert(mCubeArray.notNull()); llassert(mCubeIndex != -1); - llassert(LLPipeline::sRenderDeferred); + //llassert(LLPipeline::sRenderDeferred); // make sure we don't walk off the edge of the render target while (resolution > gPipeline.mRT->deferredScreen.getWidth() || -- cgit v1.2.3 From 70f249fbfbcae080aff3db72bf62e0643b342236 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 11 Nov 2022 13:48:51 -0600 Subject: SL-18630 Fix for probes often ending up under the terrain. --- indra/newview/llreflectionmap.cpp | 138 ++++++++++++++------------------------ 1 file changed, 52 insertions(+), 86 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index ef611966ed..f346531bfd 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -63,20 +63,7 @@ void LLReflectionMap::autoAdjustOrigin() const LLVector4a* bounds = mGroup->getBounds(); auto* node = mGroup->getOctreeNode(); - if (mGroup->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_TERRAIN) - { - // for terrain, make probes float a couple meters above the highest point in the surface patch - mOrigin = bounds[0]; - mOrigin.getF32ptr()[2] += bounds[1].getF32ptr()[2] + 3.f; - - // update radius to encompass bounding box - LLVector4a d; - d.setAdd(bounds[0], bounds[1]); - d.sub(mOrigin); - mRadius = d.getLength3().getF32(); - mPriority = 1; - } - else if (mGroup->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) + if (mGroup->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) { mPriority = 1; // cast a ray towards 8 corners of bounding box @@ -87,92 +74,71 @@ void LLReflectionMap::autoAdjustOrigin() return; } - if (node->isLeaf() || node->getChildCount() > 1 || node->getElementCount() > 0) - { // use center of object bounding box for leaf nodes or nodes with multiple child nodes - mOrigin = bounds[0]; - - LLVector4a start; - LLVector4a end; - - LLVector4a size = bounds[1]; + mOrigin = bounds[0]; - LLVector4a corners[] = - { - { 1, 1, 1 }, - { -1, 1, 1 }, - { 1, -1, 1 }, - { -1, -1, 1 }, - { 1, 1, -1 }, - { -1, 1, -1 }, - { 1, -1, -1 }, - { -1, -1, -1 } - }; - - for (int i = 0; i < 8; ++i) - { - corners[i].mul(size); - corners[i].add(bounds[0]); - } + LLVector4a size = bounds[1]; - LLVector4a extents[2]; - extents[0].setAdd(bounds[0], bounds[1]); - extents[1].setSub(bounds[0], bounds[1]); + LLVector4a corners[] = + { + { 1, 1, 1 }, + { -1, 1, 1 }, + { 1, -1, 1 }, + { -1, -1, 1 }, + { 1, 1, -1 }, + { -1, 1, -1 }, + { 1, -1, -1 }, + { -1, -1, -1 } + }; + + for (int i = 0; i < 8; ++i) + { + corners[i].mul(size); + corners[i].add(bounds[0]); + } - bool hit = false; - for (int i = 0; i < 8; ++i) - { - int face = -1; - LLVector4a intersection; - LLDrawable* drawable = mGroup->lineSegmentIntersect(bounds[0], corners[i], true, false, true, &face, &intersection); - if (drawable != nullptr) - { - hit = true; - update_min_max(extents[0], extents[1], intersection); - } - else - { - update_min_max(extents[0], extents[1], corners[i]); - } - } + LLVector4a extents[2]; + extents[0].setAdd(bounds[0], bounds[1]); + extents[1].setSub(bounds[0], bounds[1]); - if (hit) + bool hit = false; + for (int i = 0; i < 8; ++i) + { + int face = -1; + LLVector4a intersection; + LLDrawable* drawable = mGroup->lineSegmentIntersect(bounds[0], corners[i], true, false, true, &face, &intersection); + if (drawable != nullptr) { - mOrigin.setAdd(extents[0], extents[1]); - mOrigin.mul(0.5f); + hit = true; + update_min_max(extents[0], extents[1], intersection); } - - // make sure radius encompasses all objects - LLSimdScalar r2 = 0.0; - for (int i = 0; i < 8; ++i) + else { - LLVector4a v; - v.setSub(corners[i], mOrigin); - - LLSimdScalar d = v.dot3(v); - - if (d > r2) - { - r2 = d; - } + update_min_max(extents[0], extents[1], corners[i]); } - - mRadius = llmax(sqrtf(r2.getF32()), 8.f); } - else - { - // user placed probe - mPriority = 2; - // use center of octree node volume for nodes that are just branches without data - mOrigin = node->getCenter(); + if (hit) + { + mOrigin.setAdd(extents[0], extents[1]); + mOrigin.mul(0.5f); + } - // update radius to encompass entire octree node volume - mRadius = node->getSize().getLength3().getF32(); + // make sure radius encompasses all objects + LLSimdScalar r2 = 0.0; + for (int i = 0; i < 8; ++i) + { + LLVector4a v; + v.setSub(corners[i], mOrigin); - //mOrigin = bounds[0]; - //mRadius = bounds[1].getLength3().getF32(); + LLSimdScalar d = v.dot3(v); + if (d > r2) + { + r2 = d; + } } + + mRadius = llmax(sqrtf(r2.getF32()), 8.f); } } else if (mViewerObject) -- cgit v1.2.3 From be9e4f186db1b3612a26e27a0294114ca66c539c Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 7 Feb 2023 13:59:10 -0600 Subject: SL-18630 Nudge underground automatic reflection probes to 2m above ground. --- indra/newview/llreflectionmap.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index f346531bfd..ce749a96c7 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -30,6 +30,7 @@ #include "pipeline.h" #include "llviewerwindow.h" #include "llviewerregion.h" +#include "llworld.h" extern F32SecondsImplicit gFrameTimeSeconds; @@ -123,6 +124,12 @@ void LLReflectionMap::autoAdjustOrigin() mOrigin.mul(0.5f); } + // make sure origin isn't under ground + F32* fp = mOrigin.getF32ptr(); + LLVector3 origin(fp); + F32 height = LLWorld::instance().resolveLandHeightAgent(origin) + 2.f; + fp[2] = llmax(fp[2], height); + // make sure radius encompasses all objects LLSimdScalar r2 = 0.0; for (int i = 0; i < 8; ++i) -- cgit v1.2.3 From 50c57b6be72541b92340c6230d417c508a4fa6f9 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 17 Feb 2023 10:34:27 -0600 Subject: SL-19128 Soften the transition between manual and automatic sphere probes. --- indra/newview/llreflectionmap.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index ce749a96c7..394596feea 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -66,7 +66,7 @@ void LLReflectionMap::autoAdjustOrigin() if (mGroup->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_VOLUME) { - mPriority = 1; + mPriority = 0; // cast a ray towards 8 corners of bounding box // nudge origin towards center of empty space @@ -150,7 +150,7 @@ void LLReflectionMap::autoAdjustOrigin() } else if (mViewerObject) { - mPriority = 64; + mPriority = 1; mOrigin.load3(mViewerObject->getPositionAgent().mV); mRadius = mViewerObject->getScale().mV[0]*0.5f; } -- cgit v1.2.3 From 19f7497d9a01731cbd82be4b522d8b879cdcb8a0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 21 Feb 2023 20:42:25 -0600 Subject: DRTVWR-559 WIP -- occlusion culling for reflection probes -- has a defect for objects close to the camera at some angles and leaks query objects, will follow up. --- indra/newview/llreflectionmap.cpp | 81 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 394596feea..9fcc6ae902 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -31,9 +31,12 @@ #include "llviewerwindow.h" #include "llviewerregion.h" #include "llworld.h" +#include "llshadermgr.h" extern F32SecondsImplicit gFrameTimeSeconds; +extern U32 get_box_fan_indices(LLCamera* camera, const LLVector4a& center); + LLReflectionMap::LLReflectionMap() { } @@ -245,3 +248,81 @@ bool LLReflectionMap::getBox(LLMatrix4& box) return false; } + +bool LLReflectionMap::isActive() +{ + return mCubeIndex != -1; +} + +void LLReflectionMap::doOcclusion(const LLVector4a& eye) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; +#if 1 + // super sloppy, but we're doing an occlusion cull against a bounding cube of + // a bounding sphere, pad radius so we assume if the eye is within + // the bounding sphere of the bounding cube, the node is not culled + F32 dist = mRadius * F_SQRT3 + 1.f; + + LLVector4a o; + o.setSub(mOrigin, eye); + + bool do_query = false; + + if (o.getLength3().getF32() < dist) + { // eye is inside radius, don't attempt to occlude + mOccluded = false; + if (mViewerObject) + { + mViewerObject->setDebugText("Camera Non-Occluded"); + } + return; + } + + if (mOcclusionQuery == 0) + { // no query was previously issued, allocate one and issue + glGenQueries(1, &mOcclusionQuery); + do_query = true; + } + else + { // query was previously issued, check it and only issue a new query + // if previous query is available + GLuint result = (GLuint) 0xFFFFFFFF; + glGetQueryObjectuiv(mOcclusionQuery, GL_QUERY_RESULT_NO_WAIT, &result); + + if (result != (GLuint) 0xFFFFFFFF) + { + do_query = true; + mOccluded = result == 0; + mOcclusionPendingFrames = 0; + } + else + { + mOcclusionPendingFrames++; + if (mViewerObject) + { + mViewerObject->setDebugText(llformat("Query Pending - %d", mOcclusionPendingFrames)); + } + } + } + + if (do_query) + { + glBeginQuery(GL_ANY_SAMPLES_PASSED, mOcclusionQuery); + + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + shader->uniform3fv(LLShaderMgr::BOX_CENTER, 1, mOrigin.getF32ptr()); + F32 r = mRadius + 0.25f; // pad by 1/4m for near clip plane etc + shader->uniform3f(LLShaderMgr::BOX_SIZE, mRadius, mRadius, mRadius); + + gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(LLViewerCamera::getInstance(), mOrigin)); + + glEndQuery(GL_ANY_SAMPLES_PASSED); + + if (mViewerObject) + { + mViewerObject->setDebugText(llformat("Query Issued - %.2f, %.2f, %.2f", o.getLength3().getF32(), dist, mRadius)); + } + } +#endif +} -- cgit v1.2.3 From 8f83724f7eb6f05150951fabac2a89f4b83abe39 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 21 Feb 2023 20:56:20 -0600 Subject: DRTVWR-559 WIP -- Kill debug text on probes (whoops) --- indra/newview/llreflectionmap.cpp | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 9fcc6ae902..fb934da02e 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -271,10 +271,6 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye) if (o.getLength3().getF32() < dist) { // eye is inside radius, don't attempt to occlude mOccluded = false; - if (mViewerObject) - { - mViewerObject->setDebugText("Camera Non-Occluded"); - } return; } @@ -298,10 +294,6 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye) else { mOcclusionPendingFrames++; - if (mViewerObject) - { - mViewerObject->setDebugText(llformat("Query Pending - %d", mOcclusionPendingFrames)); - } } } @@ -312,17 +304,11 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye) LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; shader->uniform3fv(LLShaderMgr::BOX_CENTER, 1, mOrigin.getF32ptr()); - F32 r = mRadius + 0.25f; // pad by 1/4m for near clip plane etc shader->uniform3f(LLShaderMgr::BOX_SIZE, mRadius, mRadius, mRadius); gPipeline.mCubeVB->drawRange(LLRender::TRIANGLE_FAN, 0, 7, 8, get_box_fan_indices(LLViewerCamera::getInstance(), mOrigin)); glEndQuery(GL_ANY_SAMPLES_PASSED); - - if (mViewerObject) - { - mViewerObject->setDebugText(llformat("Query Issued - %.2f, %.2f, %.2f", o.getLength3().getF32(), dist, mRadius)); - } } #endif } -- cgit v1.2.3 From 65d69ce80dca112ea0bfd06f2749d4d6fcb366b4 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 22 Feb 2023 11:01:18 -0600 Subject: DRTVWR-559 Fix for stall in probe occlusion culling and fix for culled neighbors getting sampled (badly). --- indra/newview/llreflectionmap.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index fb934da02e..37ad74e54d 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -41,6 +41,14 @@ LLReflectionMap::LLReflectionMap() { } +LLReflectionMap::~LLReflectionMap() +{ + if (mOcclusionQuery) + { + glDeleteQueries(1, &mOcclusionQuery); + } +} + void LLReflectionMap::update(U32 resolution, U32 face) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; @@ -276,18 +284,21 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye) if (mOcclusionQuery == 0) { // no query was previously issued, allocate one and issue + LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - glGenQueries"); glGenQueries(1, &mOcclusionQuery); do_query = true; } else { // query was previously issued, check it and only issue a new query // if previous query is available - GLuint result = (GLuint) 0xFFFFFFFF; - glGetQueryObjectuiv(mOcclusionQuery, GL_QUERY_RESULT_NO_WAIT, &result); + LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - glGetQueryObject"); + GLuint result = 0; + glGetQueryObjectuiv(mOcclusionQuery, GL_QUERY_RESULT_AVAILABLE, &result); - if (result != (GLuint) 0xFFFFFFFF) + if (result > 0) { do_query = true; + glGetQueryObjectuiv(mOcclusionQuery, GL_QUERY_RESULT, &result); mOccluded = result == 0; mOcclusionPendingFrames = 0; } @@ -299,6 +310,7 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye) if (do_query) { + LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - push query"); glBeginQuery(GL_ANY_SAMPLES_PASSED, mOcclusionQuery); LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; -- cgit v1.2.3 From bb79718c8f0050569c80a1bfe4dd428321706d1a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 6 Apr 2023 13:21:25 -0500 Subject: SL-19538 Followup -- scrub all possible sources of NaNs, make dynamic exposure controls not persist, limit exposure range, and do a debug gl pass. --- indra/newview/llreflectionmap.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 37ad74e54d..89ac0df286 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -265,6 +265,11 @@ bool LLReflectionMap::isActive() void LLReflectionMap::doOcclusion(const LLVector4a& eye) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; + if (LLGLSLShader::sProfileEnabled) + { + return; + } + #if 1 // super sloppy, but we're doing an occlusion cull against a bounding cube of // a bounding sphere, pad radius so we assume if the eye is within -- cgit v1.2.3 From de73cf7599e934441fe760f53163b0504c03adc7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 7 Apr 2023 11:06:09 -0500 Subject: SL-19538 Remove clouds from irradiance maps and don't conflate max probe samples with max probe neighbors, and don't move manual probes after they are complete (removes flickering around Sponza). --- indra/newview/llreflectionmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 89ac0df286..261aa51d62 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -70,7 +70,7 @@ void LLReflectionMap::autoAdjustOrigin() { LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; - if (mGroup) + if (mGroup && !mComplete) { const LLVector4a* bounds = mGroup->getBounds(); auto* node = mGroup->getOctreeNode(); -- cgit v1.2.3 From 413ce656c8e910bf3758afc3fa354e07be2d4561 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 7 Apr 2023 14:10:53 -0500 Subject: SL-19538 Clear probes on sky setting slam. Better probe update prioritization. Incidental decruft. --- indra/newview/llreflectionmap.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 261aa51d62..624fbd1758 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -169,7 +169,6 @@ void LLReflectionMap::autoAdjustOrigin() bool LLReflectionMap::intersects(LLReflectionMap* other) { - // TODO: incorporate getBox LLVector4a delta; delta.setSub(other->mOrigin, mOrigin); @@ -239,11 +238,13 @@ bool LLReflectionMap::getBox(LLMatrix4& box) scale.set_scale(glh::vec3f(s.mV)); if (vobjp->mDrawable != nullptr) { + // object to agent space (no scale) glh::matrix4f rm((F32*)vobjp->mDrawable->getWorldMatrix().mMatrix); - glh::matrix4f rt((F32*)vobjp->getRelativeXform().mMatrix); + // construct object to camera space (with scale) + mv = mv * rm * scale; - mv = mv * rm * scale; // *rt; + // inverse is camera space to object unit cube mv = mv.inverse(); box = LLMatrix4(mv.m); -- cgit v1.2.3 From 37eee397b70e2a13a1309025207d1c301f7070c5 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 18 Apr 2023 19:11:38 -0500 Subject: 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. --- indra/newview/llreflectionmap.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/newview/llreflectionmap.cpp') 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 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; -- cgit v1.2.3 From 21b67896e9d1d181f39b8e44b9efe2b4c153d22b Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 26 Jun 2023 15:37:18 -0500 Subject: SL-19909 Fix for reflection probes on vehicles blocking mouse clicks. Incidental instrumentation and decruft. --- indra/newview/llreflectionmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 72dab0cba8..efaf068bd2 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -117,7 +117,7 @@ void LLReflectionMap::autoAdjustOrigin() { int face = -1; LLVector4a intersection; - LLDrawable* drawable = mGroup->lineSegmentIntersect(bounds[0], corners[i], true, false, true, &face, &intersection); + LLDrawable* drawable = mGroup->lineSegmentIntersect(bounds[0], corners[i], false, false, true, &face, &intersection); if (drawable != nullptr) { hit = true; -- cgit v1.2.3 From b67172aa12be4a37c83042437844747ff0e02e34 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Fri, 21 Jul 2023 15:46:12 -0500 Subject: SL-20010 Make reflection probes ignore touch actions. --- indra/newview/llreflectionmap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index efaf068bd2..a039c8072a 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -117,7 +117,7 @@ void LLReflectionMap::autoAdjustOrigin() { int face = -1; LLVector4a intersection; - LLDrawable* drawable = mGroup->lineSegmentIntersect(bounds[0], corners[i], false, false, true, &face, &intersection); + LLDrawable* drawable = mGroup->lineSegmentIntersect(bounds[0], corners[i], false, false, true, true, &face, &intersection); if (drawable != nullptr) { hit = true; -- cgit v1.2.3 From 2ce27627a18787113c1b9a1fd99b5a516d693a8c Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 30 Aug 2023 11:20:11 -0500 Subject: SL-19842 Followup -- fix sunlight going black and make automatic object probes more wishy-washy (removes dark splotches where probes get stuck in walls) --- indra/newview/llreflectionmap.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index a039c8072a..2a2f4dbd5a 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -157,6 +157,7 @@ void LLReflectionMap::autoAdjustOrigin() } mRadius = llmax(sqrtf(r2.getF32()), 8.f); + } } else if (mViewerObject) @@ -204,6 +205,14 @@ F32 LLReflectionMap::getNearClip() { ret = ((LLVOVolume*)mViewerObject)->getReflectionProbeNearClip(); } + else if (mGroup) + { + ret = mRadius * 0.5f; // default to half radius for automatic object probes + } + else + { + ret = 1.f; // default to 1m for automatic terrain probes + } return llmax(ret, MINIMUM_NEAR_CLIP); } -- cgit v1.2.3 From 75a0719ff59118c0a5c6713e952cab4d0640a7d5 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 30 Aug 2023 12:57:48 -0500 Subject: SL-19842 Followup -- less aggressive ambient kill. --- indra/newview/llreflectionmap.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llreflectionmap.cpp') diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp index 2a2f4dbd5a..ec54fa1165 100644 --- a/indra/newview/llreflectionmap.cpp +++ b/indra/newview/llreflectionmap.cpp @@ -157,6 +157,9 @@ void LLReflectionMap::autoAdjustOrigin() } mRadius = llmax(sqrtf(r2.getF32()), 8.f); + + // make sure near clip doesn't poke through ground + fp[2] = llmax(fp[2], height+mRadius*0.5f); } } -- cgit v1.2.3