diff options
33 files changed, 145 insertions, 170 deletions
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 8b470d235c..5dfce4ae16 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -83,7 +83,7 @@ const F32 LIGHT_MAX_CUTOFF = 180.f; // reflection probes const F32 REFLECTION_PROBE_MIN_AMBIANCE = 0.f; -const F32 REFLECTION_PROBE_MAX_AMBIANCE = 1.f; +const F32 REFLECTION_PROBE_MAX_AMBIANCE = 100.f; const F32 REFLECTION_PROBE_DEFAULT_AMBIANCE = 0.f; const F32 REFLECTION_PROBE_MIN_CLIP_DISTANCE = 0.f; const F32 REFLECTION_PROBE_MAX_CLIP_DISTANCE = 1024.f; diff --git a/indra/llprimitive/lltextureentry.cpp b/indra/llprimitive/lltextureentry.cpp index a665db378b..17b1f4cf5c 100644 --- a/indra/llprimitive/lltextureentry.cpp +++ b/indra/llprimitive/lltextureentry.cpp @@ -559,10 +559,17 @@ void LLTextureEntry::setGLTFMaterial(LLGLTFMaterial* material, bool local_origin } } -void LLTextureEntry::setGLTFMaterialOverride(LLGLTFMaterial* mat) +S32 LLTextureEntry::setGLTFMaterialOverride(LLGLTFMaterial* mat) { llassert(mat == nullptr || getGLTFMaterial() != nullptr); // if override is not null, base material must not be null - mGLTFMaterialOverrides = mat; + if (mat == mGLTFMaterialOverrides) + { + return TEM_CHANGE_NONE; + } + + mGLTFMaterialOverrides = mat; + + return TEM_CHANGE_TEXTURE; } S32 LLTextureEntry::setBaseMaterial() diff --git a/indra/llprimitive/lltextureentry.h b/indra/llprimitive/lltextureentry.h index 9a81181f3a..f5f2c0172d 100644 --- a/indra/llprimitive/lltextureentry.h +++ b/indra/llprimitive/lltextureentry.h @@ -200,7 +200,7 @@ public: // GLTF override LLGLTFMaterial* getGLTFMaterialOverride() const { return mGLTFMaterialOverrides; } - void setGLTFMaterialOverride(LLGLTFMaterial* mat); + S32 setGLTFMaterialOverride(LLGLTFMaterial* mat); // Clear most overrides so the render material better matches the material // ID (preserve transforms). If the overrides become passthrough, set the // overrides to nullptr. diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 016cbe6e75..e1679c7f52 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -276,7 +276,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) } } - if (features->hasAtmospherics || features->isDeferred) + if (features->hasAtmospherics || features->isDeferred || features->hasTransport) { if (!shader->attachFragmentObject("windlight/atmosphericsFuncs.glsl")) { return FALSE; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b197182009..3bc636bac4 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2212,7 +2212,7 @@ if (LL_TESTS) # llremoteparcelrequest.cpp llviewerhelputil.cpp llversioninfo.cpp - llvocache.cpp +# llvocache.cpp llworldmap.cpp llworldmipmap.cpp ) @@ -2226,12 +2226,12 @@ if (LL_TESTS) #llviewertexturelist.cpp ) - set_source_files_properties( - llvocache.cpp - PROPERTIES - LL_TEST_ADDITIONAL_SOURCE_FILES ../llmessage/lldatapacker.cpp - LL_TEST_ADDITIONAL_PROJECTS "llprimitive" - ) +# set_source_files_properties( +# llvocache.cpp +# PROPERTIES +# LL_TEST_ADDITIONAL_SOURCE_FILES ../llmessage/lldatapacker.cpp +# LL_TEST_ADDITIONAL_PROJECTS "llprimitive" +# ) set(test_libs llcommon diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 5ffd610fba..4490e3eec2 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10347,17 +10347,6 @@ <key>Value</key> <integer>128</integer> </map> - <key>RenderReflectionProbeAmbianceScale</key> - <map> - <key>Comment</key> - <string>Scaler to apply to reflection probes to over-brighten sky contributions to indirect light</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>F32</string> - <key>Value</key> - <real>8</real> - </map> <key>RenderTonemapper</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 3a15fd1111..03df9fd4a1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -44,7 +44,6 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); vec3 srgb_to_linear(vec3 cs); vec3 linear_to_srgb(vec3 cl); vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); #ifdef HAS_ALPHA_MASK uniform float minimum_alpha; @@ -88,8 +87,9 @@ void main() #endif #ifndef IS_HUD - color.rgb = fullbrightAtmosTransport(color.rgb); color.rgb = srgb_to_linear(color.rgb); + color.rgb = fullbrightAtmosTransport(color.rgb); + #endif frag_color.rgb = color.rgb; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index 0090155e5c..62d134188c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -91,7 +91,7 @@ void main() vary_LightNormPosDot = rel_pos_lightnorm_dot; // Initialize temp variables - vec3 sunlight = (sun_up_factor == 1) ? sunlight_color*2.0 : moonlight_color; + vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color; // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index e7322c14fb..70be9a9029 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -276,9 +276,7 @@ void main() color.rgb *= diffuse_linear.rgb; - color.rgb = linear_to_srgb(color.rgb); color.rgb = atmosFragLightingLinear(color.rgb, additive, atten); - color.rgb = srgb_to_linear(color.rgb); vec4 light = vec4(0,0,0,0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl index fb76db99a0..b76443f0f0 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -83,7 +83,6 @@ vec3 linear_to_srgb(vec3 c); void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive); vec3 atmosFragLightingLinear(vec3 color, vec3 additive, vec3 atten); -vec3 scaleSoftClipFragLinear(vec3 color); void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist); float calcLegacyDistanceAttenuation(float distance, float falloff); @@ -236,11 +235,8 @@ void main() color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten, spec); glare += max(max(spec.r, spec.g), spec.b); - color.rgb = linear_to_srgb(color.rgb); color.rgb = atmosFragLightingLinear(color.rgb, additive, atten); - color.rgb = scaleSoftClipFragLinear(color.rgb); - color.rgb = srgb_to_linear(color.rgb); - + vec3 light = vec3(0); // Punctual lights diff --git a/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl b/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl index baf68e11f4..d21af946e0 100644 --- a/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl +++ b/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl @@ -32,7 +32,6 @@ uniform samplerCubeArray reflectionProbes; uniform int sourceIdx; uniform float max_probe_lod; -uniform float ambiance_scale; in vec3 vary_dir; @@ -200,8 +199,6 @@ vec4 filterColor(vec3 N) color /= float(u_sampleCount); - color.rgb *= ambiance_scale; - return color; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 1d02498209..22e93496d2 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -30,10 +30,14 @@ vec3 scaleSoftClipFrag(vec3 light); vec3 srgb_to_linear(vec3 col); vec3 linear_to_srgb(vec3 col); +uniform int sun_up_factor; + vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { light *= atten.r; - light += additive * 2.0; + additive = srgb_to_linear(additive*2.0); + additive *= sun_up_factor + 1.0; + light += additive; return light; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl index c2527db218..12a99edc34 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl @@ -63,9 +63,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 rel_pos_norm = normalize(rel_pos); float rel_pos_len = length(rel_pos); - float scale = sun_up_factor + 1; vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color; - sunlight *= scale; // sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes @@ -143,7 +141,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou // fudge sunlit and amblit to get consistent lighting compared to legacy // midday before PBR was a thing - sunlit = sunlight.rgb / scale; + sunlit = sunlight.rgb; amblit = tmpAmbient.rgb * 0.25; additive *= vec3(1.0 - combined_haze); diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index 6aa719d200..8221ba9516 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -30,14 +30,13 @@ vec3 getAdditiveColor(); vec3 getAtmosAttenuation(); -vec3 srgb_to_linear(vec3 col); -vec3 linear_to_srgb(vec3 col); +vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten); + +// the below implementations are deprecated but remain here as adapters for shaders that haven't been refactored yet vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { - light *= atten.r; - light += additive * 2.0; - return light; + return atmosFragLighting(light, additive, atten); } vec3 atmosTransport(vec3 light) @@ -45,30 +44,17 @@ vec3 atmosTransport(vec3 light) return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); } -vec3 fullbrightAtmosTransportFragLinear(vec3 light, vec3 additive, vec3 atten) -{ - // same as non-linear version, probably fine - //float brightness = dot(light.rgb * 0.5, vec3(0.3333)) + 0.1; - //return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive, brightness * brightness); - return atmosTransportFrag(light, additive, atten); -} - vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { - //float brightness = dot(light.rgb * 0.5, vec3(0.3333)) + 0.1; - //return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive, brightness * brightness); return atmosTransportFrag(light, additive, atten); } vec3 fullbrightAtmosTransport(vec3 light) { - //return fullbrightAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); return atmosTransport(light); } vec3 fullbrightShinyAtmosTransport(vec3 light) { - //float brightness = dot(light.rgb, vec3(0.33333)); - //return mix(atmosTransport(light.rgb), (light.rgb + getAdditiveColor().rgb) * (2.0 - brightness), brightness * brightness); return atmosTransport(light); } diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index b90de7609b..f6bed16c84 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -43,9 +43,7 @@ VARYING vec3 vary_position; uniform samplerCube environmentMap; -vec3 fullbrightShinyAtmosTransport(vec3 light); vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); -vec3 fullbrightScaleSoftClip(vec3 light); void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); @@ -88,9 +86,8 @@ void main() sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity); applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity); - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); - color.rgb = fullbrightScaleSoftClip(color.rgb); color.rgb = srgb_to_linear(color.rgb); + color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); #endif color.a = 1.0; diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index 6e41df34a4..02ab4494f6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -44,7 +44,6 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); vec3 atmosFragLightingLinear(vec3 l, vec3 additive, vec3 atten); vec3 scaleSoftClipFragLinear(vec3 l); void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive); -vec3 fullbrightAtmosTransportFragLinear(vec3 light, vec3 additive, vec3 atten); vec3 srgb_to_linear(vec3 cs); vec3 linear_to_srgb(vec3 cs); @@ -386,10 +385,7 @@ void main() glare += cur_glare; } - color.rgb = linear_to_srgb(color.rgb); color.rgb = atmosFragLightingLinear(color.rgb, additive, atten); - color.rgb = scaleSoftClipFragLinear(color.rgb); - color.rgb = srgb_to_linear(color.rgb); vec3 npos = normalize(-pos.xyz); vec3 light = vec3(0, 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 0e3ebd1534..7953360054 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -71,7 +71,6 @@ vec4 getPositionWithDepth(vec2 pos_screen, float depth); void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive); vec3 atmosFragLightingLinear(vec3 l, vec3 additive, vec3 atten); vec3 scaleSoftClipFragLinear(vec3 l); -vec3 fullbrightAtmosTransportFragLinear(vec3 light, vec3 additive, vec3 atten); // reflection probe interface void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, @@ -212,6 +211,7 @@ void main() { //should only be true of WL sky, just port over base color value color = srgb_to_linear(texture2D(emissiveRect, tc).rgb); + color *= sun_up_factor + 1.0; } else { @@ -262,9 +262,7 @@ void main() if (do_atmospherics) { - color = linear_to_srgb(color); color = atmosFragLightingLinear(color, additive, atten); - color = srgb_to_linear(color); } } diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl index 9da86759c9..ec0439fa97 100644 --- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl @@ -282,11 +282,7 @@ void main() color = mix(color, fb.rgb, f); - color.rgb = linear_to_srgb(color.rgb); color = atmosFragLightingLinear(color, additive, atten); - color = scaleSoftClipFragLinear(color); - color.rgb = srgb_to_linear(color.rgb); - float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0.05); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 12ed123805..b17c78abac 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4281,7 +4281,7 @@ U32 LLAppViewer::getObjectCacheVersion() { // Viewer object cache version, change if object update // format changes. JC - const U32 INDRA_OBJECT_CACHE_VERSION = 15; + const U32 INDRA_OBJECT_CACHE_VERSION = 16; return INDRA_OBJECT_CACHE_VERSION; } diff --git a/indra/newview/llfetchedgltfmaterial.cpp b/indra/newview/llfetchedgltfmaterial.cpp index 2e71b4fa87..4efe1ad189 100644 --- a/indra/newview/llfetchedgltfmaterial.cpp +++ b/indra/newview/llfetchedgltfmaterial.cpp @@ -89,7 +89,7 @@ void LLFetchedGLTFMaterial::bind(LLViewerTexture* media_tex) if (!LLPipeline::sShadowRender) { - if (mNormalTexture.notNull()) + if (mNormalTexture.notNull() && mNormalTexture->getDiscardLevel() <= 4) { shader->bindTexture(LLShaderMgr::BUMP_MAP, mNormalTexture); } diff --git a/indra/newview/llgltfmateriallist.cpp b/indra/newview/llgltfmateriallist.cpp index 57a67f52f6..08ce43434f 100644 --- a/indra/newview/llgltfmateriallist.cpp +++ b/indra/newview/llgltfmateriallist.cpp @@ -192,14 +192,7 @@ public: { LL_DEBUGS("GLTF") << "material overrides cache" << LL_ENDL; - // default to main region if message doesn't specify - LLViewerRegion * region = gAgent.getRegion();; - - if (object_override.mHasRegionHandle) - { - // TODO start requiring this once server sends this for all messages - region = LLWorld::instance().getRegionFromHandle(object_override.mRegionHandle); - } + LLViewerRegion * region = LLWorld::instance().getRegionFromHandle(object_override.mRegionHandle); if (region) { @@ -248,8 +241,8 @@ public: { results.reserve(object_override.mSides.size()); // parse json - std::map<S32, std::string>::const_iterator iter = object_override.mSides.begin(); - std::map<S32, std::string>::const_iterator end = object_override.mSides.end(); + std::unordered_map<S32, std::string>::const_iterator iter = object_override.mSides.begin(); + std::unordered_map<S32, std::string>::const_iterator end = object_override.mSides.end(); while (iter != end) { LLPointer<LLGLTFMaterial> override_data = new LLGLTFMaterial(); @@ -278,7 +271,6 @@ public: }, [object_override, this](std::vector<ReturnData> results) // Callback to main thread { - LLViewerObject * obj = gObjectList.findObject(object_override.mObjectId); if (results.size() > 0 ) @@ -292,23 +284,16 @@ public: // flag this side to not be nulled out later side_set.insert(results[i].mSide); - if (!obj || !obj->setTEGLTFMaterialOverride(results[i].mSide, results[i].mMaterial)) + if (obj) { - // object not ready to receive override data, queue for later - gGLTFMaterialList.queueOverrideUpdate(object_override.mObjectId, results[i].mSide, results[i].mMaterial); - } - else if (obj && obj->getTE(results[i].mSide) && obj->getTE(results[i].mSide)->isSelected()) - { - doSelectionCallbacks(object_override.mObjectId, results[i].mSide); + obj->setTEGLTFMaterialOverride(results[i].mSide, results[i].mMaterial); } } - else + + // unblock material editor + if (obj && obj->getTE(results[i].mSide) && obj->getTE(results[i].mSide)->isSelected()) { - // unblock material editor - if (obj && obj->getTE(results[i].mSide) && obj->getTE(results[i].mSide)->isSelected()) - { - doSelectionCallbacks(object_override.mObjectId, results[i].mSide); - } + doSelectionCallbacks(object_override.mObjectId, results[i].mSide); } } @@ -353,6 +338,7 @@ namespace void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFMaterial* override_data) { +#if 0 override_list_t& overrides = mQueuedOverrides[id]; if (overrides.size() < side + 1) @@ -361,6 +347,7 @@ void LLGLTFMaterialList::queueOverrideUpdate(const LLUUID& id, S32 side, LLGLTFM } overrides[side] = override_data; +#endif } void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj) @@ -368,6 +355,8 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj) LL_PROFILE_ZONE_SCOPED; llassert(obj); + +#if 0 const LLUUID& id = obj->getID(); auto iter = mQueuedOverrides.find(id); @@ -410,6 +399,14 @@ void LLGLTFMaterialList::applyQueuedOverrides(LLViewerObject* obj) mQueuedOverrides.erase(iter); } +#else + // the override cache is the authoritarian source of the most recent override data + LLViewerRegion* regionp = obj->getRegion(); + if (regionp) + { + regionp->applyCacheMiscExtras(obj); + } +#endif } void LLGLTFMaterialList::queueModify(const LLViewerObject* obj, S32 side, const LLGLTFMaterial* mat) diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index 09ac7e57a4..bccd76415f 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -651,10 +651,6 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face) S32 channel = gIrradianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY); mTexture->bind(channel); - static LLCachedControl<F32> ambiance_scale(gSavedSettings, "RenderReflectionProbeAmbianceScale", 8.f); - static LLStaticHashedString ambiance_scale_str("ambiance_scale"); - - gIrradianceGenProgram.uniform1f(ambiance_scale_str, ambiance_scale); gIrradianceGenProgram.uniform1i(sSourceIdx, sourceIdx); gIrradianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index fc9b3093e8..4d99ee1386 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1375,7 +1375,7 @@ S32 LLSpatialPartition::cull(LLCamera &camera, std::vector<LLDrawable *>* result selecter.traverse(mOctree); return 0; - } +} extern BOOL gCubeSnapshot; @@ -1540,6 +1540,7 @@ void pushVertsColorCoded(LLSpatialGroup* group) // - a linked rigged drawable face has the wrong draw order index bool check_rigged_group(LLDrawable* drawable) { +#if 0 if (drawable->isState(LLDrawable::RIGGED)) { LLSpatialGroup* group = drawable->getSpatialGroup(); @@ -1587,7 +1588,7 @@ bool check_rigged_group(LLDrawable* drawable) } } } - +#endif return true; } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 1c53bddb62..e641ac4215 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -5399,19 +5399,22 @@ S32 LLViewerObject::setTEGLTFMaterialOverride(U8 te, LLGLTFMaterial* override_ma return retval; } - tep->setGLTFMaterialOverride(override_mat); + retval = tep->setGLTFMaterialOverride(override_mat); - if (override_mat) + if (retval) { - LLFetchedGLTFMaterial* render_mat = new LLFetchedGLTFMaterial(*src_mat); - render_mat->applyOverride(*override_mat); - tep->setGLTFRenderMaterial(render_mat); - retval = TEM_CHANGE_TEXTURE; + if (override_mat) + { + LLFetchedGLTFMaterial* render_mat = new LLFetchedGLTFMaterial(*src_mat); + render_mat->applyOverride(*override_mat); + tep->setGLTFRenderMaterial(render_mat); + retval = TEM_CHANGE_TEXTURE; - } - else if (tep->setGLTFRenderMaterial(nullptr)) - { - retval = TEM_CHANGE_TEXTURE; + } + else if (tep->setGLTFRenderMaterial(nullptr)) + { + retval = TEM_CHANGE_TEXTURE; + } } return retval; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 192a96a408..d3ee6daa6f 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -2651,20 +2651,8 @@ LLViewerRegion::eCacheUpdateResult LLViewerRegion::cacheFullUpdate(LLViewerObjec void LLViewerRegion::cacheFullUpdateGLTFOverride(const LLGLTFOverrideCacheEntry &override_data) { - LLUUID object_id = override_data.mObjectId; - LLViewerObject * obj = gObjectList.findObject(object_id); - if (obj != nullptr) - { - llassert(obj->getRegion() == this); - - U32 local_id = obj->getLocalID(); - - mImpl->mGLTFOverridesJson[local_id] = override_data; - } - else - { - LL_WARNS("GLTF") << "got material override for unknown object_id, cannot cache it" << LL_ENDL; - } + U32 local_id = override_data.mLocalId; + mImpl->mGLTFOverridesJson[local_id] = override_data; } LLVOCacheEntry* LLViewerRegion::getCacheEntryForOctree(U32 local_id) @@ -3560,3 +3548,22 @@ void LLViewerRegion::loadCacheMiscExtras(U32 local_id) LLGLTFMaterialList::loadCacheOverrides(iter->second); } } + +void LLViewerRegion::applyCacheMiscExtras(LLViewerObject* obj) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; + llassert(obj); + + U32 local_id = obj->getLocalID(); + auto iter = mImpl->mGLTFOverridesJson.find(local_id); + if (iter != mImpl->mGLTFOverridesJson.end()) + { + llassert(iter->second.mGLTFMaterial.size() == iter->second.mSides.size()); + + for (auto& side : iter->second.mGLTFMaterial) + { + obj->setTEGLTFMaterialOverride(side.first, side.second); + } + } +} + diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index b132a3a5f3..fe0fdfb930 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -426,6 +426,8 @@ private: public: void loadCacheMiscExtras(U32 local_id); + void applyCacheMiscExtras(LLViewerObject* obj); + struct CompareDistance { bool operator()(const LLViewerRegion* const& lhs, const LLViewerRegion* const& rhs) diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index b50cb49b7e..8b402e210d 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -1920,7 +1920,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredFullbrightProgram.mFeatures.calculatesAtmospherics = true; gDeferredFullbrightProgram.mFeatures.hasGamma = true; gDeferredFullbrightProgram.mFeatures.hasTransport = true; - gDeferredFullbrightProgram.mFeatures.hasSrgb = true; + gDeferredFullbrightProgram.mFeatures.hasSrgb = true; gDeferredFullbrightProgram.mFeatures.mIndexedTextureChannels = LLGLSLShader::sIndexedTextureChannels; gDeferredFullbrightProgram.mShaderFiles.clear(); gDeferredFullbrightProgram.mShaderFiles.push_back(make_pair("deferred/fullbrightV.glsl", GL_VERTEX_SHADER)); diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp index 0fbcf9c624..7081ecaa4b 100644 --- a/indra/newview/llvocache.cpp +++ b/indra/newview/llvocache.cpp @@ -57,9 +57,14 @@ BOOL check_write(LLAPRFile* apr_file, void* src, S32 n_bytes) bool LLGLTFOverrideCacheEntry::fromLLSD(const LLSD& data) { - if (!data.has("object_id")) + LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; + + llassert(data.has("local_id")); + llassert(data.has("object_id")); + llassert(data.has("region_handle_x") && data.has("region_handle_y")); + + if (!data.has("local_id")) { - mObjectId.setNull(); return false; } @@ -69,13 +74,13 @@ bool LLGLTFOverrideCacheEntry::fromLLSD(const LLSD& data) U32 region_handle_y = data["region_handle_y"].asInteger(); U32 region_handle_x = data["region_handle_x"].asInteger(); mRegionHandle = to_region_handle(region_handle_x, region_handle_y); - mHasRegionHandle = true; } else { - mHasRegionHandle = false; + return false; } + mLocalId = data["local_id"].asInteger(); mObjectId = data["object_id"]; // message should be interpreted thusly: @@ -94,7 +99,26 @@ bool LLGLTFOverrideCacheEntry::fromLLSD(const LLSD& data) for (int i = 0; i < sides.size(); ++i) { S32 side_idx = sides[i].asInteger(); - mSides[side_idx] = gltf_json[i].asString(); + std::string gltf_json_str = gltf_json[i].asString(); + mSides[side_idx] = gltf_json_str; + LLGLTFMaterial* override_mat = new LLGLTFMaterial(); + std::string error, warn; + if (override_mat->fromJSON(gltf_json_str, warn, error)) + { + mGLTFMaterial[i] = 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; + } + } } } else @@ -107,16 +131,15 @@ bool LLGLTFOverrideCacheEntry::fromLLSD(const LLSD& data) LLSD LLGLTFOverrideCacheEntry::toLLSD() const { + LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; LLSD data; - if (mHasRegionHandle) - { - U32 region_handle_x, region_handle_y; - from_region_handle(mRegionHandle, ®ion_handle_x, ®ion_handle_y); - data["region_handle_y"] = LLSD::Integer(region_handle_y); - data["region_handle_x"] = LLSD::Integer(region_handle_x); - } + U32 region_handle_x, region_handle_y; + from_region_handle(mRegionHandle, ®ion_handle_x, ®ion_handle_y); + data["region_handle_y"] = LLSD::Integer(region_handle_y); + data["region_handle_x"] = LLSD::Integer(region_handle_x); data["object_id"] = mObjectId; + data["local_id"] = (LLSD::Integer) mLocalId; for (auto const & side : mSides) { diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h index dcc8d37c5c..ec0df31828 100644 --- a/indra/newview/llvocache.h +++ b/indra/newview/llvocache.h @@ -32,6 +32,7 @@ #include "lldir.h" #include "llvieweroctree.h" #include "llapr.h" +#include "llgltfmaterial.h" #include <unordered_map> @@ -46,9 +47,10 @@ public: LLSD toLLSD() const; LLUUID mObjectId; - std::map<S32, std::string> mSides; //json per side - U64 mRegionHandle; - bool mHasRegionHandle; + U32 mLocalId = 0; + std::unordered_map<S32, std::string> mSides; //json per side + std::unordered_map<S32, LLPointer<LLGLTFMaterial> > mGLTFMaterial; //GLTF material per side + U64 mRegionHandle = 0; }; class LLVOCacheEntry diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index dfe365b737..11deff5bff 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -5637,15 +5637,6 @@ void LLPipeline::setupHWLights() // Ambient LLColor4 ambient = psky->getTotalAmbient(); - static LLCachedControl<F32> ambiance_scale(gSavedSettings, "RenderReflectionProbeAmbianceScale", 8.f); - - F32 light_scale = 1.f; - - if (gCubeSnapshot && !mReflectionMapManager.isRadiancePass()) - { //darken local lights based on brightening of sky lighting - light_scale = 1.f / ambiance_scale; - } - gGL.setAmbientLightColor(ambient); bool sun_up = environment.getIsSunUp(); @@ -5739,7 +5730,7 @@ void LLPipeline::setupHWLights() } //send linear light color to shader - LLColor4 light_color = light->getLightLinearColor()*light_scale; + LLColor4 light_color = light->getLightLinearColor(); light_color.mV[3] = 0.0f; F32 fade = iter->fade; @@ -7885,15 +7876,6 @@ void LLPipeline::renderDeferredLighting() llassert(!sRenderingHUDs); - static LLCachedControl<F32> ambiance_scale(gSavedSettings, "RenderReflectionProbeAmbianceScale", 8.f); - - F32 light_scale = 1.f; - - if (gCubeSnapshot && !mReflectionMapManager.isRadiancePass()) - { //darken local lights based on brightening of sky lighting - light_scale = 1.f / ambiance_scale; - } - LLRenderTarget *screen_target = &mRT->screen; LLRenderTarget* deferred_light_target = &mRT->deferredLight; @@ -8129,7 +8111,7 @@ void LLPipeline::renderDeferredLighting() F32 s = volume->getLightRadius() * 1.5f; // send light color to shader in linear space - LLColor3 col = volume->getLightLinearColor()*light_scale; + LLColor3 col = volume->getLightLinearColor(); if (col.magVecSquared() < 0.001f) { @@ -8223,7 +8205,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredSpotLightProgram, drawablep); // send light color to shader in linear space - LLColor3 col = volume->getLightLinearColor() * light_scale; + LLColor3 col = volume->getLightLinearColor(); gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c); gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s); @@ -8298,7 +8280,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredMultiSpotLightProgram, drawablep); // send light color to shader in linear space - LLColor3 col = volume->getLightLinearColor() * light_scale; + LLColor3 col = volume->getLightLinearColor(); gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v); gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, light_size_final); diff --git a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml index 39fe573c98..f6bfb3574d 100644 --- a/indra/newview/skins/default/xui/en/floater_adjust_environment.xml +++ b/indra/newview/skins/default/xui/en/floater_adjust_environment.xml @@ -266,7 +266,7 @@ layout="topleft" left_delta="5" min_val="0" - max_val="1" + max_val="10" name="probe_ambiance" top_pad="5" width="185" diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 1faf9c3152..5e999ed245 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -2574,7 +2574,7 @@ even though the user gets a free copy. label="Ambiance" label_width="55" left="10" - max_val="1" + max_val="100" min_val="0" mouse_opaque="true" name="Probe Ambiance" diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml index 094be36b01..a80b1a9166 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_atmos.xml @@ -333,7 +333,7 @@ layout="topleft" left_delta="5" min_val="0" - max_val="1" + max_val="10" name="probe_ambiance" top_delta="20" width="219" |