From 894c9e0417e7b29aaf31c673ca040dff93eb36ef Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 22 Aug 2023 13:17:58 -0500 Subject: SL-19842 WIP -- Move sky auto adjustment magic numbers to debug settings. --- indra/newview/app_settings/settings.xml | 67 ++++++++++++++++++++++ .../class1/windlight/atmosphericsFuncs.glsl | 6 +- indra/newview/llsettingsvo.cpp | 22 ++++++- indra/newview/pipeline.cpp | 4 +- 4 files changed, 93 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0cd63d9d5f..4612ee1a82 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10656,6 +10656,73 @@ Value 2.0 + RendeSkyAutoAdjustBlueHorizonScale + + Comment + Blue Horizon Scale value to use when auto-adjusting legacy skies + Persist + 1 + Type + F32 + Value + 1.0 + + RendeSkyAutoAdjustBlueDensityScale + + Comment + Blue Horizon Scale value to use when auto-adjusting legacy skies + Persist + 1 + Type + F32 + Value + 1.0 + + RenderSkyAutoAdjustSunColorScale + + Comment + Sun color scalar when auto-adjusting legacy skies + Persist + 1 + Type + F32 + Value + 1.0 + + RenderSkyAutoAdjustProbeAmbiance + + Comment + Probe ambiance value when auto-adjusting legacy skies + Persist + 1 + Type + F32 + Value + 1.0 + + RenderSkySunlightScale + + Comment + Sunlight scale fudge factor for matching with pre-PBR viewer + Persist + 1 + Type + F32 + Value + 1.5 + + RenderSkyAmbientScale + + Comment + Ambient scale fudge factor for matching with pre-PBR viewer + Persist + 1 + Type + F32 + Value + 0.5 + + RenderReflectionProbeMaxLocalLightAmbiance Comment diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index 437fa0a6d5..53474ded7f 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -40,6 +40,8 @@ uniform vec3 glow; uniform float scene_light_strength; uniform float sun_moon_glow_factor; uniform float sky_hdr_scale; +uniform float sky_sunlight_scale; +uniform float sky_ambient_scale; float getAmbientClamp() { return 1.0f; } @@ -148,8 +150,8 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou // multiply to get similar colors as when the "scaleSoftClip" implementation was doubling color values // (allows for mixing of light sources other than sunlight e.g. reflection probes) - sunlit *= 1.5; - amblit *= 0.5; + sunlit *= sky_sunlight_scale; //1.5; + amblit *= sky_ambient_scale; //0.5; // override amblit with ambient_color if sky probe ambiance is not zero amblit = mix(amblit, ambient_color, clamp(sky_hdr_scale-1.0, 0.0, 1.0)); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 264359a3a9..9ccac82e63 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -721,6 +721,15 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force) static LLCachedControl should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true); static LLCachedControl auto_adjust_ambient_scale(gSavedSettings, "RenderSkyAutoAdjustAmbientScale", 0.75f); static LLCachedControl auto_adjust_hdr_scale(gSavedSettings, "RenderSkyAutoAdjustHDRScale", 2.f); + static LLCachedControl auto_adjust_blue_horizon_scale(gSavedSettings, "RenderSkyAutoAdjustBlueHorizonScale", 1.f); + static LLCachedControl auto_adjust_blue_density_scale(gSavedSettings, "RenderSkyAutoAdjustBlueDensityScale", 1.f); + static LLCachedControl auto_adjust_sun_color_scale(gSavedSettings, "RenderSkyAutoAdjustSunColorScale", 1.f); + static LLCachedControl auto_adjust_probe_ambiance(gSavedSettings, "RenderSkyAutoAdjustProbeAmbiance", 1.f); + static LLCachedControl sunlight_scale(gSavedSettings, "RenderSkySunlightScale", 1.5f); + static LLCachedControl ambient_scale(gSavedSettings, "RenderSkyAmbientScale", 1.5f); + + shader->uniform1f(LLShaderMgr::SKY_SUNLIGHT_SCALE, sunlight_scale); + shader->uniform1f(LLShaderMgr::SKY_AMBIENT_SCALE, ambient_scale); static LLCachedControl cloud_shadow_scale(gSavedSettings, "RenderCloudShadowAmbianceFactor", 0.125f); F32 probe_ambiance = getTotalReflectionProbeAmbiance(cloud_shadow_scale); @@ -740,7 +749,16 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force) { // auto-adjust legacy sky to take advantage of probe ambiance shader->uniform3fv(LLShaderMgr::AMBIENT, (ambient * auto_adjust_ambient_scale).mV); shader->uniform1f(LLShaderMgr::SKY_HDR_SCALE, auto_adjust_hdr_scale); - probe_ambiance = 1.f; // NOTE -- must match LLSettingsSky::getReflectionProbeAmbiance value for "auto_adjust" true + LLColor3 blue_horizon = getBlueHorizon() * auto_adjust_blue_horizon_scale; + LLColor3 blue_density = getBlueDensity() * auto_adjust_blue_density_scale; + LLColor3 sun_diffuse = getSunDiffuse() * auto_adjust_sun_color_scale; + + shader->uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, sun_diffuse.mV); + shader->uniform3fv(LLShaderMgr::BLUE_DENSITY, blue_density.mV); + shader->uniform3fv(LLShaderMgr::BLUE_HORIZON, blue_horizon.mV); + + LLSettingsSky::sAutoAdjustProbeAmbiance = auto_adjust_probe_ambiance; + probe_ambiance = auto_adjust_probe_ambiance; // NOTE -- must match LLSettingsSky::getReflectionProbeAmbiance value for "auto_adjust" true } else { @@ -755,7 +773,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force) shader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, getSunMoonGlowFactor()); shader->uniform1f(LLShaderMgr::DENSITY_MULTIPLIER, getDensityMultiplier()); shader->uniform1f(LLShaderMgr::DISTANCE_MULTIPLIER, getDistanceMultiplier()); - + shader->uniform1f(LLShaderMgr::GAMMA, g); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1620b1ff4c..0b5908a440 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7730,8 +7730,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m); } - shader.uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV); - shader.uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV); + //shader.uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV); + //shader.uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV); shader.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mReflectionMapManager.mMaxProbeLOD); } -- cgit v1.2.3 From 455bbcf742691b709353aa3c3e35a76d0ff38ee4 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 29 Aug 2023 16:42:55 -0500 Subject: SL-20229 Add GenericStreamingMessage and use it to receive GLTF material overrides --- indra/newview/llappviewer.cpp | 2 +- indra/newview/llgltfmateriallist.cpp | 75 ++++++++++++++++++++++++++------ indra/newview/llgltfmateriallist.h | 3 ++ indra/newview/llstartup.cpp | 1 + indra/newview/llviewergenericmessage.cpp | 18 +++++++- indra/newview/llviewergenericmessage.h | 1 + indra/newview/llviewerregion.cpp | 16 +++---- indra/newview/llvocache.cpp | 34 ++++----------- indra/newview/llvocache.h | 2 +- 9 files changed, 103 insertions(+), 49 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 343778fe03..a6e938e54c 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4138,7 +4138,7 @@ U32 LLAppViewer::getObjectCacheVersion() { // Viewer object cache version, change if object update // format changes. JC - const U32 INDRA_OBJECT_CACHE_VERSION = 16; + const U32 INDRA_OBJECT_CACHE_VERSION = 17; return INDRA_OBJECT_CACHE_VERSION; } diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 99a052f719..a204315a2a 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -160,9 +160,9 @@ public: // sides - array of S32 indices of texture entries // gltf_json - array of corresponding Strings of GLTF json for override data - LLSD message; bool success = true; +#if 0 //deprecated for(const std::string& llsdRaw : strings) { std::istringstream llsdData(llsdRaw); @@ -198,6 +198,7 @@ public: applyData(object_override); } +#endif return success; } @@ -213,6 +214,7 @@ public: { // Parse the data +#if 0 // DEPRECATED LL::WorkQueue::ptr_t main_queue = LL::WorkQueue::getInstance("mainloop"); LL::WorkQueue::ptr_t general_queue = LL::WorkQueue::getInstance("General"); @@ -235,24 +237,17 @@ public: results.reserve(sides.size()); // parse json - std::unordered_map::const_iterator iter = sides.begin(); - std::unordered_map::const_iterator end = sides.end(); + std::unordered_map::const_iterator iter = sides.begin(); + std::unordered_map::const_iterator end = sides.end(); while (iter != end) { - std::string warn_msg, error_msg; - ReturnData result; - bool success = result.mMaterial.fromJSON(iter->second, warn_msg, error_msg); - - result.mSuccess = success; + result.mMaterial.applyOverrideLLSD(iter->second); + + result.mSuccess = true; result.mSide = iter->first; - if (!success) - { - LL_WARNS("GLTF") << "failed to parse GLTF override data. errors: " << error_msg << " | warnings: " << warn_msg << LL_ENDL; - } - results.push_back(result); iter++; } @@ -318,6 +313,7 @@ public: } }); } +#endif } private: @@ -330,6 +326,59 @@ namespace LLGLTFMaterialOverrideDispatchHandler handle_gltf_override_message; } +void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::string& data_in) +{ + std::istringstream str(data_in); + + LLSD data; + + LLSDSerialize::fromNotation(data, str, data_in.length()); + + const LLHost& host = msg->getSender(); + + LLViewerRegion* region = LLWorld::instance().getRegion(host); + + if (region) + { + U32 local_id = data.get("id").asInteger(); + LLUUID id; + gObjectList.getUUIDFromLocal(id, local_id, host.getAddress(), host.getPort()); + LLViewerObject* obj = gObjectList.findObject(id); + + if (obj) + { + const LLSD& tes = data["te"]; + const LLSD& od = data["od"]; + + if (tes.isArray()) + { + LLGLTFOverrideCacheEntry cache; + cache.mLocalId = local_id; + cache.mObjectId = id; + cache.mRegionHandle = region->getHandle(); + + for (int i = 0; i < tes.size(); ++i) + { + S32 te = tes[i].asInteger(); + LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride will take ownership + mat->applyOverrideLLSD(od[i]); + obj->setTEGLTFMaterialOverride(te, mat); + + cache.mSides[te] = od[i]; + cache.mGLTFMaterial[te] = mat; + + if (obj->getTE(te) && obj->getTE(te)->isSelected()) + { + handle_gltf_override_message.doSelectionCallbacks(id, te); + } + } + + region->cacheFullUpdateGLTFOverride(cache); + } + } + } +} + void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data) { #if 0 diff --git a/indra/newview/llgltfmateriallist.h b/indra/newview/llgltfmateriallist.h index ce8781baba..7317214019 100644 --- a/indra/newview/llgltfmateriallist.h +++ b/indra/newview/llgltfmateriallist.h @@ -101,6 +101,9 @@ public: static void loadCacheOverrides(const LLGLTFOverrideCacheEntry& override); + // Apply an override update with the given data + void applyOverrideMessage(LLMessageSystem* msg, const std::string& data); + private: friend class LLGLTFMaterialOverrideDispatchHandler; // save an override update that we got from the simulator for later (for example, if an override arrived for an unknown object) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 8ffab761f4..eccfd40fe6 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2709,6 +2709,7 @@ void register_viewer_callbacks(LLMessageSystem* msg) msg->setHandlerFunc("InitiateDownload", process_initiate_download); msg->setHandlerFunc("LandStatReply", LLFloaterTopObjects::handle_land_reply); msg->setHandlerFunc("GenericMessage", process_generic_message); + msg->setHandlerFunc("GenericStreamingMessage", process_generic_streaming_message); msg->setHandlerFunc("LargeGenericMessage", process_large_generic_message); msg->setHandlerFuncFast(_PREHASH_FeatureDisabled, process_feature_disabled_message); diff --git a/indra/newview/llviewergenericmessage.cpp b/indra/newview/llviewergenericmessage.cpp index d3de9d72bf..7ea792c404 100644 --- a/indra/newview/llviewergenericmessage.cpp +++ b/indra/newview/llviewergenericmessage.cpp @@ -32,9 +32,10 @@ #include "lldispatcher.h" #include "lluuid.h" #include "message.h" +#include "llgenericstreamingmessage.h" #include "llagent.h" - +#include "llgltfmateriallist.h" LLDispatcher gGenericDispatcher; @@ -92,6 +93,21 @@ void process_generic_message(LLMessageSystem* msg, void**) } } +void process_generic_streaming_message(LLMessageSystem* msg, void**) +{ + LLGenericStreamingMessage data; + data.unpack(msg); + switch (data.mMethod) + { + case LLGenericStreamingMessage::METHOD_GLTF_MATERIAL_OVERRIDE: + gGLTFMaterialList.applyOverrideMessage(msg, data.mData); + break; + default: + LL_WARNS() << "GenericStreamingMessage received unknown method: " << data.mMethod << LL_ENDL; + break; + } +} + void process_large_generic_message(LLMessageSystem* msg, void**) { LLUUID agent_id; diff --git a/indra/newview/llviewergenericmessage.h b/indra/newview/llviewergenericmessage.h index 170f38a485..96a73a3d5f 100644 --- a/indra/newview/llviewergenericmessage.h +++ b/indra/newview/llviewergenericmessage.h @@ -38,6 +38,7 @@ void send_generic_message(const std::string& method, const LLUUID& invoice = LLUUID::null); void process_generic_message(LLMessageSystem* msg, void**); +void process_generic_streaming_message(LLMessageSystem* msg, void**); void process_large_generic_message(LLMessageSystem* msg, void**); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 6b92b16ef4..ead1e8c073 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -215,7 +215,7 @@ public: LLVOCacheEntry::vocache_entry_set_t mVisibleEntries; //must-be-created visible entries wait for objects creation. LLVOCacheEntry::vocache_entry_priority_list_t mWaitingList; //transient list storing sorted visible entries waiting for object creation. std::set mNonCacheableCreatedList; //list of local ids of all non-cacheable objects - LLVOCacheEntry::vocache_gltf_overrides_map_t mGLTFOverridesJson; // for materials + LLVOCacheEntry::vocache_gltf_overrides_map_t mGLTFOverridesLLSD; // for materials // time? // LRU info? @@ -787,7 +787,7 @@ void LLViewerRegion::loadObjectCache() { LLVOCache & vocache = LLVOCache::instance(); vocache.readFromCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap); - vocache.readGenericExtrasFromCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesJson); + vocache.readGenericExtrasFromCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesLLSD); if (mImpl->mCacheMap.empty()) { @@ -817,7 +817,7 @@ void LLViewerRegion::saveObjectCache() LLVOCache & instance = LLVOCache::instance(); instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled); - instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesJson, mCacheDirty, removal_enabled); + instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesLLSD, mCacheDirty, removal_enabled); mCacheDirty = FALSE; } @@ -2656,7 +2656,7 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data) { U32 local_id = override_data.mLocalId; - mImpl->mGLTFOverridesJson[local_id] = override_data; + mImpl->mGLTFOverridesLLSD[local_id] = override_data; } LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) @@ -3546,8 +3546,8 @@ std::string LLViewerRegion::getSimHostName() void LLViewerRegion::loadCacheMiscExtras(U32 local_id) { - auto iter = mImpl->mGLTFOverridesJson.find(local_id); - if (iter != mImpl->mGLTFOverridesJson.end()) + auto iter = mImpl->mGLTFOverridesLLSD.find(local_id); + if (iter != mImpl->mGLTFOverridesLLSD.end()) { LLGLTFMaterialList::loadCacheOverrides(iter->second); } @@ -3559,8 +3559,8 @@ void LLViewerRegion::applyCacheMiscExtras(LLViewerObject* obj) llassert(obj); U32 local_id = obj->getLocalID(); - auto iter = mImpl->mGLTFOverridesJson.find(local_id); - if (iter != mImpl->mGLTFOverridesJson.end()) + auto iter = mImpl->mGLTFOverridesLLSD.find(local_id); + if (iter != mImpl->mGLTFOverridesLLSD.end()) { llassert(iter->second.mGLTFMaterial.size() == iter->second.mSides.size()); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index a92057d010..dd5b9f9fd5 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -85,40 +85,24 @@ bool LLGLTFOverrideCacheEntry::fromLLSD(const LLSD& data) // message should be interpreted thusly: /// sides is a list of face indices - // gltf_json is a list of corresponding json + // gltf_llsd is a list of corresponding GLTF override LLSD // any side not represented in "sides" has no override - if (data.has("sides") && data.has("gltf_json")) + if (data.has("sides") && data.has("gltf_llsd")) { LLSD const& sides = data.get("sides"); - LLSD const& gltf_json = data.get("gltf_json"); + LLSD const& gltf_llsd = data.get("gltf_llsd"); - if (sides.isArray() && gltf_json.isArray() && + if (sides.isArray() && gltf_llsd.isArray() && sides.size() != 0 && - sides.size() == gltf_json.size()) + sides.size() == gltf_llsd.size()) { for (int i = 0; i < sides.size(); ++i) { S32 side_idx = sides[i].asInteger(); - std::string gltf_json_str = gltf_json[i].asString(); - mSides[side_idx] = gltf_json_str; + mSides[side_idx] = gltf_llsd[i]; LLGLTFMaterial* override_mat = new LLGLTFMaterial(); - std::string error, warn; - if (override_mat->fromJSON(gltf_json_str, warn, error)) - { - mGLTFMaterial[side_idx] = override_mat; - } - else - { - LL_WARNS() << "Invalid GLTF string: \n" << gltf_json_str << LL_ENDL; - if (!error.empty()) - { - LL_WARNS() << "Error: " << error << LL_ENDL; - } - if (!warn.empty()) - { - LL_WARNS() << "Warning: " << warn << LL_ENDL; - } - } + override_mat->applyOverrideLLSD(gltf_llsd[i]); + mGLTFMaterial[side_idx] = override_mat; } } else @@ -157,7 +141,7 @@ LLSD LLGLTFOverrideCacheEntry::toLLSD() const // check that mSides and mGLTFMaterial have exactly the same keys present llassert(mGLTFMaterial.count(side.first) == 1); data["sides"].append(LLSD::Integer(side.first)); - data["gltf_json"].append(side.second); + data["gltf_llsd"].append(side.second); } return data; diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index ec0df31828..8525edd121 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -48,7 +48,7 @@ public: LLUUID mObjectId; U32 mLocalId = 0; - std::unordered_map mSides; //json per side + std::unordered_map mSides; //override LLSD per side std::unordered_map > mGLTFMaterial; //GLTF material per side U64 mRegionHandle = 0; }; -- 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 +++++++++ indra/newview/pipeline.cpp | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'indra/newview') 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); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 0b5908a440..78d4e65d42 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7730,8 +7730,18 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_ shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m); } - //shader.uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV); - //shader.uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV); + // auto adjust legacy sun color if needed + static LLCachedControl should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true); + static LLCachedControl auto_adjust_sun_color_scale(gSavedSettings, "RenderSkyAutoAdjustSunColorScale", 1.f); + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + LLColor3 sun_diffuse(mSunDiffuse.mV); + if (should_auto_adjust && psky->canAutoAdjust()) + { + sun_diffuse *= auto_adjust_sun_color_scale; + } + + shader.uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, 1, sun_diffuse.mV); + shader.uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV); shader.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mReflectionMapManager.mMaxProbeLOD); } -- 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/app_settings/settings.xml | 2 +- indra/newview/llreflectionmap.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ee4c76943e..b4e149f0e0 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10654,7 +10654,7 @@ Type F32 Value - 0.5 + 0.7 RenderSkyAutoAdjustHDRScale 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 From 43cd4e84bc01abcf2820b9557abe761fbf5e8432 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Wed, 6 Sep 2023 10:31:03 -0500 Subject: SL-19842 WIP -- Change how probe ambiance mixes with sky ambient. --- .../class1/deferred/postDeferredGammaCorrect.glsl | 3 ++- .../shaders/class2/deferred/alphaF.glsl | 6 ++--- .../shaders/class2/deferred/pbralphaF.glsl | 9 +++---- .../shaders/class2/deferred/reflectionProbeF.glsl | 8 +++--- .../shaders/class3/deferred/fullbrightShinyF.glsl | 4 +-- .../shaders/class3/deferred/materialF.glsl | 7 +++-- .../shaders/class3/deferred/reflectionProbeF.glsl | 31 ++++++++++++---------- .../shaders/class3/deferred/softenLightF.glsl | 16 +++++------ .../shaders/class3/environment/waterF.glsl | 4 +-- 9 files changed, 44 insertions(+), 44 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index 53e4f02314..64e6bc9da2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -105,7 +105,8 @@ vec3 toneMap(vec3 color) color *= exposure * exp_scale; - color = toneMapACES_Hill(color); + // mix ACES and Linear here as a compromise to avoid over-darkening legacy content + color = mix(toneMapACES_Hill(color), color, 0.333); #endif return color; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index da5f997429..3a251af240 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -85,7 +85,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); float getAmbientClamp(); void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear); vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, float ambiance) { @@ -251,7 +251,7 @@ void main() vec3 irradiance; vec3 glossenv; vec3 legacyenv; - sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0, true); + sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0, true, amblit_linear); float da = dot(norm.xyz, light_dir.xyz); @@ -266,7 +266,7 @@ void main() vec3 sun_contrib = min(final_da, shadow) * sunlit_linear; - color.rgb = max(amblit, irradiance); + color.rgb = irradiance; color.rgb += sun_contrib; diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl index e8db856b1f..be66b6feb2 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -92,7 +92,7 @@ void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float float calcLegacyDistanceAttenuation(float distance, float falloff); float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear); void waterClip(vec3 pos); @@ -224,11 +224,8 @@ void main() float gloss = 1.0 - perceptualRoughness; vec3 irradiance = vec3(0); vec3 radiance = vec3(0); - sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true); - // Take maximium of legacy ambient vs irradiance sample as irradiance - // NOTE: ao is applied in pbrIbl (see pbrBaseLight), do not apply here - irradiance = max(amblit,irradiance); - + sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true, amblit); + vec3 diffuseColor; vec3 specularColor; calcDiffuseSpecular(col.rgb, metallic, diffuseColor, specularColor); diff --git a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl index aa6f5a3b62..52e71edcac 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl @@ -34,7 +34,7 @@ uniform mat3 env_mat; vec3 srgb_to_linear(vec3 c); void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent) + vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear) { ambenv = vec3(reflection_probe_ambiance * 0.25); @@ -44,9 +44,9 @@ void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, } void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness) + vec2 tc, vec3 pos, vec3 norm, float glossiness, vec3 amblit_linear) { - sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness, false); + sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness, false, amblit_linear); } vec4 sampleReflectionProbesDebug(vec3 pos) @@ -56,7 +56,7 @@ vec4 sampleReflectionProbesDebug(vec3 pos) } void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent) + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear) { ambenv = vec3(reflection_probe_ambiance * 0.25); diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index 1537714bb7..54a887262b 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -49,7 +49,7 @@ vec3 srgb_to_linear(vec3 c); // reflection probe interface void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear); void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); @@ -80,7 +80,7 @@ void main() vec3 legacyenv; vec3 norm = normalize(vary_texcoord1.xyz); vec4 spec = vec4(0,0,0,0); - sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity, false); + sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity, false, amblit); color.rgb = legacy_adjust(color.rgb); color.rgb = srgb_to_linear(color.rgb); diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index 82e2de0c0f..319f2f25b7 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -60,7 +60,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); #endif void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear); void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm); void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); @@ -339,10 +339,9 @@ void main() vec3 ambenv; vec3 glossenv; vec3 legacyenv; - sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true); + sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true, amblit_linear); - // use sky settings ambient or irradiance map sample, whichever is brighter - color = max(amblit_linear, ambenv); + color = ambenv; float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); vec3 sun_contrib = min(da, shadow) * sunlit_linear; diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 41821def8e..906e66ecc8 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -530,7 +530,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, // w - weight of sample (distance and angular attenuation) // dw - weight of sample (distance only) // i - index of probe -vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i) +vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i, vec3 amblit) { // parallax adjustment vec3 v; @@ -556,9 +556,12 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int v -= c; v = env_mat * v; - { - return textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x; - } + + vec3 col = textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x; + + col = mix(amblit, col, min(refParams[i].x, 1.0)); + + return col; } vec3 sampleProbes(vec3 pos, vec3 dir, float lod) @@ -619,7 +622,7 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod) return col[1]+col[0]; } -vec3 sampleProbeAmbient(vec3 pos, vec3 dir) +vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit) { // modified copy/paste of sampleProbes follows, will likely diverge from sampleProbes further // as irradiance map mixing is tuned independently of radiance map mixing @@ -649,7 +652,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir) float w = 0; float dw = 0; - vec3 refcol = tapIrradianceMap(pos, dir, w, dw, refSphere[i].xyz, i); + vec3 refcol = tapIrradianceMap(pos, dir, w, dw, refSphere[i].xyz, i, amblit); col[p] += refcol*w; wsum[p] += w; @@ -679,14 +682,14 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir) } void doProbeSample(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent) + vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit) { // TODO - don't hard code lods float reflection_lods = max_probe_lod; vec3 refnormpersp = reflect(pos.xyz, norm.xyz); - ambenv = sampleProbeAmbient(pos, norm); + ambenv = sampleProbeAmbient(pos, norm, amblit); float lod = (1.0-glossiness)*reflection_lods; glossenv = sampleProbes(pos, normalize(refnormpersp), lod); @@ -712,14 +715,14 @@ void doProbeSample(inout vec3 ambenv, inout vec3 glossenv, } void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent) + vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit) { preProbeSample(pos); - doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, transparent); + doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, transparent, amblit); } void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness) + vec2 tc, vec3 pos, vec3 norm, float glossiness, vec3 amblit) { // don't sample automatic probes for water sample_automatic = false; @@ -728,7 +731,7 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, // always include void probe on water probeIndex[probeInfluences++] = 0; - doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, false); + doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, false, amblit); // fudge factor to get PBR water at a similar luminance ot legacy water glossenv *= 0.4; @@ -783,14 +786,14 @@ vec4 sampleReflectionProbesDebug(vec3 pos) } void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent) + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit) { float reflection_lods = max_probe_lod; preProbeSample(pos); vec3 refnormpersp = reflect(pos.xyz, norm.xyz); - ambenv = sampleProbeAmbient(pos, norm); + ambenv = sampleProbeAmbient(pos, norm, amblit); if (glossiness > 0.0) { diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 4ef003e0cb..8b0ea23897 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -69,9 +69,9 @@ vec3 scaleSoftClipFragLinear(vec3 l); // reflection probe interface void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear); void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear); void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm); void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); float getDepth(vec2 pos_screen); @@ -117,10 +117,10 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, vec3 l); //surface point to light -void adjustIrradiance(inout vec3 irradiance, vec3 amblit_linear, float ambocc) +void adjustIrradiance(inout vec3 irradiance, float ambocc) { // use sky settings ambient or irradiance map sample, whichever is brighter - irradiance = max(amblit_linear, irradiance); + //irradiance = max(amblit_linear, irradiance); #if defined(HAS_SSAO) irradiance = mix(ssao_effect_mat * min(irradiance.rgb*ssao_irradiance_scale, vec3(ssao_irradiance_max)), irradiance.rgb, ambocc); @@ -194,9 +194,9 @@ void main() // PBR IBL float gloss = 1.0 - perceptualRoughness; - sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false); + sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear); - adjustIrradiance(irradiance, amblit_linear, ambocc); + adjustIrradiance(irradiance, ambocc); vec3 diffuseColor; vec3 specularColor; @@ -232,9 +232,9 @@ void main() vec3 glossenv = vec3(0); vec3 legacyenv = vec3(0); - sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false); + sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false, amblit_linear); - adjustIrradiance(irradiance, amblit_linear, ambocc); + adjustIrradiance(irradiance, ambocc); // apply lambertian IBL only (see pbrIbl) color.rgb = irradiance; diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl index 8fee259933..4f79dd1ac5 100644 --- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl @@ -124,7 +124,7 @@ vec3 transform_normal(vec3 vNt) } void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness); + vec2 tc, vec3 pos, vec3 norm, float glossiness, vec3 amblit_linear); vec3 getPositionWithNDC(vec3 ndc); @@ -237,7 +237,7 @@ void main() vec3 irradiance = vec3(0); vec3 radiance = vec3(0); - sampleReflectionProbesWater(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss); + sampleReflectionProbesWater(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss, amblit); irradiance = vec3(0); -- cgit v1.2.3 From 1514ade10dc0f64c476ff405256b86fb6a1d9b57 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 11 Sep 2023 09:20:00 -0500 Subject: SL-19842 WIP -- Now that probes can override ambient, unroll ambient darkening hacks. --- indra/newview/app_settings/settings.xml | 8 ++++---- .../app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl | 8 ++------ indra/newview/llsettingsvo.cpp | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b4e149f0e0..35ab1e9d40 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10654,7 +10654,7 @@ Type F32 Value - 0.7 + 1.0 RenderSkyAutoAdjustHDRScale @@ -10709,7 +10709,7 @@ Type F32 Value - 1.0 + 0.001 RenderSkySunlightScale @@ -10720,7 +10720,7 @@ Type F32 Value - 1.5 + 1.0 RenderSkyAmbientScale @@ -10731,7 +10731,7 @@ Type F32 Value - 0.5 + 0.7 RenderReflectionProbeMaxLocalLightAmbiance diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index 53474ded7f..a8aa5a36a3 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -39,7 +39,6 @@ uniform float max_y; uniform vec3 glow; uniform float scene_light_strength; uniform float sun_moon_glow_factor; -uniform float sky_hdr_scale; uniform float sky_sunlight_scale; uniform float sky_ambient_scale; @@ -150,12 +149,9 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou // multiply to get similar colors as when the "scaleSoftClip" implementation was doubling color values // (allows for mixing of light sources other than sunlight e.g. reflection probes) - sunlit *= sky_sunlight_scale; //1.5; - amblit *= sky_ambient_scale; //0.5; + sunlit *= sky_sunlight_scale; + amblit *= sky_ambient_scale; - // override amblit with ambient_color if sky probe ambiance is not zero - amblit = mix(amblit, ambient_color, clamp(sky_hdr_scale-1.0, 0.0, 1.0)); - amblit = srgb_to_linear(amblit); amblit *= ambientLighting(norm, light_dir); } diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 9ccac82e63..b7c4dbe648 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -742,7 +742,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force) { if (psky->getReflectionProbeAmbiance() != 0.f) { - shader->uniform3fv(LLShaderMgr::AMBIENT, getAmbientColor().mV); + shader->uniform3fv(LLShaderMgr::AMBIENT, LLVector3(ambient.mV)); shader->uniform1f(LLShaderMgr::SKY_HDR_SCALE, sqrtf(g)*2.0); // use a modifier here so 1.0 maps to the "most desirable" default and the maximum value doesn't go off the rails } else if (psky->canAutoAdjust() && should_auto_adjust) -- cgit v1.2.3 From db480d11fe69e54fb0387c6624657673b2f414e9 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 18 Sep 2023 14:16:15 -0500 Subject: SL-20229 Add blip for GLTF messages to "Show Updates to Objects" --- indra/newview/llgltfmateriallist.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index a204315a2a..655311f53d 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -347,6 +347,12 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s if (obj) { + if (gShowObjectUpdates) + { // display a cyan blip for override updates when "Show Updates to Objects" enabled + LLColor4 color(0.f, 1.f, 1.f, 1.f); + gPipeline.addDebugBlip(obj->getPositionAgent(), color); + } + const LLSD& tes = data["te"]; const LLSD& od = data["od"]; -- cgit v1.2.3 From 83fb74720f27b8a203bc7a143931ecc5b4770c01 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Mon, 18 Sep 2023 15:55:23 -0500 Subject: SL-20229 Cache GLTF updates that are received before the object they're applied to is loaded. --- indra/newview/llgltfmateriallist.cpp | 53 ++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 655311f53d..0bdfcf05e7 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -337,6 +337,7 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s const LLHost& host = msg->getSender(); LLViewerRegion* region = LLWorld::instance().getRegion(host); + llassert(region); if (region) { @@ -345,43 +346,47 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s gObjectList.getUUIDFromLocal(id, local_id, host.getAddress(), host.getPort()); LLViewerObject* obj = gObjectList.findObject(id); - if (obj) - { - if (gShowObjectUpdates) - { // display a cyan blip for override updates when "Show Updates to Objects" enabled - LLColor4 color(0.f, 1.f, 1.f, 1.f); - gPipeline.addDebugBlip(obj->getPositionAgent(), color); - } + // NOTE: obj may be null if the viewer hasn't heard about the object yet, cache update in any case + + if (obj && gShowObjectUpdates) + { // display a cyan blip for override updates when "Show Updates to Objects" enabled + LLColor4 color(0.f, 1.f, 1.f, 1.f); + gPipeline.addDebugBlip(obj->getPositionAgent(), color); + } - const LLSD& tes = data["te"]; - const LLSD& od = data["od"]; + const LLSD& tes = data["te"]; + const LLSD& od = data["od"]; - if (tes.isArray()) + if (tes.isArray()) + { + LLGLTFOverrideCacheEntry cache; + cache.mLocalId = local_id; + cache.mObjectId = id; + cache.mRegionHandle = region->getHandle(); + + for (int i = 0; i < tes.size(); ++i) { - LLGLTFOverrideCacheEntry cache; - cache.mLocalId = local_id; - cache.mObjectId = id; - cache.mRegionHandle = region->getHandle(); + LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership + mat->applyOverrideLLSD(od[i]); - for (int i = 0; i < tes.size(); ++i) - { - S32 te = tes[i].asInteger(); - LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride will take ownership - mat->applyOverrideLLSD(od[i]); - obj->setTEGLTFMaterialOverride(te, mat); + S32 te = tes[i].asInteger(); - cache.mSides[te] = od[i]; - cache.mGLTFMaterial[te] = mat; + cache.mSides[te] = od[i]; + cache.mGLTFMaterial[te] = mat; + if (obj) + { + obj->setTEGLTFMaterialOverride(te, mat); if (obj->getTE(te) && obj->getTE(te)->isSelected()) { handle_gltf_override_message.doSelectionCallbacks(id, te); } } - - region->cacheFullUpdateGLTFOverride(cache); } + + region->cacheFullUpdateGLTFOverride(cache); } + } } -- cgit v1.2.3 From 61ca550e64730afaaefd4db2234f886fb968f27e Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Tue, 19 Sep 2023 12:34:05 -0500 Subject: SL-20229 Fix for mac build (and don't spam log on viewers that don't know about a particular GenericStreamingMessage method) --- indra/newview/llviewergenericmessage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewergenericmessage.cpp b/indra/newview/llviewergenericmessage.cpp index 7ea792c404..aaa1313ff6 100644 --- a/indra/newview/llviewergenericmessage.cpp +++ b/indra/newview/llviewergenericmessage.cpp @@ -103,7 +103,7 @@ void process_generic_streaming_message(LLMessageSystem* msg, void**) gGLTFMaterialList.applyOverrideMessage(msg, data.mData); break; default: - LL_WARNS() << "GenericStreamingMessage received unknown method: " << data.mMethod << LL_ENDL; + LL_WARNS_ONCE() << "Received unknown method" << LL_ENDL; break; } } -- cgit v1.2.3 From 360ffff2885bff2f816c099dc414dc126cb7e258 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Thu, 21 Sep 2023 14:54:22 -0500 Subject: SL-20321 Interpret missing TEs in override messages as indication overrides should be nulled out if present. --- indra/newview/llgltfmateriallist.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 0bdfcf05e7..a92e699c42 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -357,6 +357,9 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s const LLSD& tes = data["te"]; const LLSD& od = data["od"]; + constexpr U32 MAX_TES = 45; + bool has_te[MAX_TES] = { false }; + if (tes.isArray()) { LLGLTFOverrideCacheEntry cache; @@ -364,13 +367,15 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s cache.mObjectId = id; cache.mRegionHandle = region->getHandle(); - for (int i = 0; i < tes.size(); ++i) + U32 count = llmin(tes.size(), MAX_TES); + for (U32 i = 0; i < count; ++i) { LLGLTFMaterial* mat = new LLGLTFMaterial(); // setTEGLTFMaterialOverride and cache will take ownership mat->applyOverrideLLSD(od[i]); S32 te = tes[i].asInteger(); + has_te[te] = true; cache.mSides[te] = od[i]; cache.mGLTFMaterial[te] = mat; @@ -384,6 +389,20 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s } } + if (obj) + { // null out overrides on TEs that shouldn't have them + U32 count = llmin(obj->getNumTEs(), MAX_TES); + for (U32 i = 0; i < count; ++i) + { + LLTextureEntry* te = obj->getTE(i); + if (te && te->getGLTFMaterialOverride()) + { + obj->setTEGLTFMaterialOverride(i, nullptr); + handle_gltf_override_message.doSelectionCallbacks(id, i); + } + } + } + region->cacheFullUpdateGLTFOverride(cache); } -- cgit v1.2.3 From 3da26ee8df6cc7e57ba3acbb91437ec97e151002 Mon Sep 17 00:00:00 2001 From: RunitaiLinden Date: Fri, 22 Sep 2023 15:31:49 -0500 Subject: SL-20321 Fix for missing "has_te" check (thanks Henri) --- indra/newview/llgltfmateriallist.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index a92e699c42..8919229c78 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -360,8 +360,8 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s constexpr U32 MAX_TES = 45; bool has_te[MAX_TES] = { false }; - if (tes.isArray()) - { + if (tes.isArray()) // NOTE: if no "te" array exists, this is a malformed message (null out all overrides will come in as an empty te array) + { LLGLTFOverrideCacheEntry cache; cache.mLocalId = local_id; cache.mObjectId = id; @@ -395,7 +395,7 @@ void LLGLTFMaterialList::applyOverrideMessage(LLMessageSystem* msg, const std::s for (U32 i = 0; i < count; ++i) { LLTextureEntry* te = obj->getTE(i); - if (te && te->getGLTFMaterialOverride()) + if (!has_te[i] && te && te->getGLTFMaterialOverride()) { obj->setTEGLTFMaterialOverride(i, nullptr); handle_gltf_override_message.doSelectionCallbacks(id, i); -- cgit v1.2.3