diff --git a/CHANGES.md b/CHANGES.md index 0093fe628..a227e76e2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,9 +2,14 @@ ### ? - ? +##### Breaking Changes :mega: + +- `UseLodTransitions` has been renamed to `EnableLodTransitions` on `Cesium3DTileset`. + ##### Fixes :wrench: -- Fixed an issue with pixel dithering artifacts that could appear on tilesets. +- Fixed an issue with flickering pixel artifacts that could appear on tilesets. +- Fixed an issue with dithering artifacts that would appear on tilesets when using non-temporal anti-aliasing methods for Forward Rendering. - Fixed an issue where DynamicPawn could get stuck after interrupting a flight from `UCesiumFlyToComponent`. ### v2.5.0 - 2024-05-01 diff --git a/Config/Engine.ini b/Config/Engine.ini index d7044876c..059779532 100644 --- a/Config/Engine.ini +++ b/Config/Engine.ini @@ -152,3 +152,8 @@ AspectRatioAxisConstraint=AspectRatio_MaintainXFOV +EnumRedirects=(OldName="ECesiumMetadataPackedGpuType", NewName="ECesiumMetadataPackedGpuType_DEPRECATED", ValueChanges=(("None","Unknown_DEPRECATED"),("Uint8","Uint8_DEPRECATED"),("Float","Float_DEPRECATED"))) +FunctionRedirects=(OldName="CesiumFeatureIdTextureBlueprintLibrary.GetTextureCoordinateIndex", NewName="CesiumFeatureIdTextureBlueprintLibrary.GetUnrealUVChannel") + ++PropertyRedirects=(OldName="Cesium3DTileset.UseLodTransitions", NewName="EnableLodTransitions") ++FunctionRedirects=(OldName="Cesium3DTileset.GetUseLodTransitions", NewName="GetEnableLodTransitions") ++FunctionRedirects=(OldName="Cesium3DTileset.SetUseLodTransitions", NewName="SetEnableLodTransitions") ++PropertyRedirects=(OldName="Cesium3DTileset.SetUseLodTransitions.InUseLodTransitions", NewName="InEnableLodTransitions") \ No newline at end of file diff --git a/Content/Materials/Layers/ML_DitherFade.uasset b/Content/Materials/Layers/ML_DitherFade.uasset index a765e0fb8..be6ddcec3 100644 Binary files a/Content/Materials/Layers/ML_DitherFade.uasset and b/Content/Materials/Layers/ML_DitherFade.uasset differ diff --git a/Source/CesiumRuntime/Private/Cesium3DTileset.cpp b/Source/CesiumRuntime/Private/Cesium3DTileset.cpp index 9272d8a52..361316c3f 100644 --- a/Source/CesiumRuntime/Private/Cesium3DTileset.cpp +++ b/Source/CesiumRuntime/Private/Cesium3DTileset.cpp @@ -87,7 +87,7 @@ ACesium3DTileset::ACesium3DTileset() _beforeMoviePreloadAncestors{PreloadAncestors}, _beforeMoviePreloadSiblings{PreloadSiblings}, _beforeMovieLoadingDescendantLimit{LoadingDescendantLimit}, - _beforeMovieUseLodTransitions{true}, + _beforeMovieEnableLodTransitions{true}, _tilesetsBeingDestroyed(0) { @@ -272,9 +272,9 @@ void ACesium3DTileset::PostInitProperties() { } } -void ACesium3DTileset::SetUseLodTransitions(bool InUseLodTransitions) { - if (InUseLodTransitions != this->UseLodTransitions) { - this->UseLodTransitions = InUseLodTransitions; +void ACesium3DTileset::SetEnableLodTransitions(bool InEnableLodTransitions) { + if (InEnableLodTransitions != this->EnableLodTransitions) { + this->EnableLodTransitions = InEnableLodTransitions; this->DestroyTileset(); } } @@ -442,13 +442,13 @@ void ACesium3DTileset::PlayMovieSequencer() { this->_beforeMoviePreloadAncestors = this->PreloadAncestors; this->_beforeMoviePreloadSiblings = this->PreloadSiblings; this->_beforeMovieLoadingDescendantLimit = this->LoadingDescendantLimit; - this->_beforeMovieUseLodTransitions = this->UseLodTransitions; + this->_beforeMovieEnableLodTransitions = this->EnableLodTransitions; this->_captureMovieMode = true; this->PreloadAncestors = false; this->PreloadSiblings = false; this->LoadingDescendantLimit = 10000; - this->UseLodTransitions = false; + this->EnableLodTransitions = false; } void ACesium3DTileset::StopMovieSequencer() { @@ -456,7 +456,7 @@ void ACesium3DTileset::StopMovieSequencer() { this->PreloadAncestors = this->_beforeMoviePreloadAncestors; this->PreloadSiblings = this->_beforeMoviePreloadSiblings; this->LoadingDescendantLimit = this->_beforeMovieLoadingDescendantLimit; - this->UseLodTransitions = this->_beforeMovieUseLodTransitions; + this->EnableLodTransitions = this->_beforeMovieEnableLodTransitions; } void ACesium3DTileset::PauseMovieSequencer() { this->StopMovieSequencer(); } @@ -1819,7 +1819,7 @@ void ACesium3DTileset::updateTilesetOptionsFromProperties() { options.enforceCulledScreenSpaceError = this->EnforceCulledScreenSpaceError; options.culledScreenSpaceError = static_cast(this->CulledScreenSpaceError); - options.enableLodTransitionPeriod = this->UseLodTransitions; + options.enableLodTransitionPeriod = this->EnableLodTransitions; options.lodTransitionLength = this->LodTransitionLength; // options.kickDescendantsWhileFadingIn = false; } @@ -2071,7 +2071,7 @@ void ACesium3DTileset::Tick(float DeltaTime) { for (Cesium3DTilesSelection::Tile* pTile : pResult->tilesFadingOut) { Cesium3DTilesSelection::TileRenderContent* pRenderContent = pTile->getContent().getRenderContent(); - if (!this->UseLodTransitions || + if (!this->EnableLodTransitions || (pRenderContent && pRenderContent->getLodTransitionFadePercentage() >= 1.0f)) { _tilesToHideNextFrame.push_back(pTile); @@ -2080,7 +2080,7 @@ void ACesium3DTileset::Tick(float DeltaTime) { showTilesToRender(pResult->tilesToRenderThisFrame); - if (this->UseLodTransitions) { + if (this->EnableLodTransitions) { TRACE_CPUPROFILER_EVENT_SCOPE(Cesium::UpdateTileFades) for (Cesium3DTilesSelection::Tile* pTile : @@ -2180,7 +2180,7 @@ void ACesium3DTileset::PostEditChangeProperty( PropName == GET_MEMBER_NAME_CHECKED(ACesium3DTileset, EnableOcclusionCulling) || PropName == - GET_MEMBER_NAME_CHECKED(ACesium3DTileset, UseLodTransitions) || + GET_MEMBER_NAME_CHECKED(ACesium3DTileset, EnableLodTransitions) || PropName == GET_MEMBER_NAME_CHECKED(ACesium3DTileset, ShowCreditsOnScreen) || PropName == GET_MEMBER_NAME_CHECKED(ACesium3DTileset, Root) || diff --git a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp index 0b90ef7ff..91ae59ff3 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp @@ -3135,10 +3135,17 @@ static void loadPrimitiveGameThreadPart( EMaterialParameterAssociation::LayerParameter, 0); - // Initialize fade uniform to fully visible, in case LOD transitions - // are off. int fadeLayerIndex = pCesiumData->LayerNames.Find("DitherFade"); if (fadeLayerIndex >= 0) { + pMaterial->SetScalarParameterValueByInfo( + FMaterialParameterInfo( + "EnableLodTransitions", + EMaterialParameterAssociation::LayerParameter, + fadeLayerIndex), + pTilesetActor->GetEnableLodTransitions() ? 1.0f : 0.0f); + + // Initialize fade uniforms to fully visible, in case LOD transitions + // are off. pMaterial->SetScalarParameterValueByInfo( FMaterialParameterInfo( "FadePercentage", @@ -3147,7 +3154,7 @@ static void loadPrimitiveGameThreadPart( 1.0f); pMaterial->SetScalarParameterValueByInfo( FMaterialParameterInfo( - "FadingType", + "FadeDirection", EMaterialParameterAssociation::LayerParameter, fadeLayerIndex), 0.0f); diff --git a/Source/CesiumRuntime/Public/Cesium3DTileset.h b/Source/CesiumRuntime/Public/Cesium3DTileset.h index e398d7889..a29624a3c 100644 --- a/Source/CesiumRuntime/Public/Cesium3DTileset.h +++ b/Source/CesiumRuntime/Public/Cesium3DTileset.h @@ -425,13 +425,14 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { * This will cause more tiles to be loaded, but helps to avoid holes and * provides a more consistent mesh, which may be helpful for physics. * - * Note that this will always be disabled if UseLodTransitions is set to true. + * Note that this will always be disabled if Enable Lod Transitions is set to + * true. */ UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Cesium|Tile Culling", - Meta = (EditCondition = "!UseLodTransitions", EditConditionHides)) + Meta = (EditCondition = "!EnableLodTransitions", EditConditionHides)) bool EnableFrustumCulling = true; /** @@ -442,13 +443,14 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { * of the camera above the ground, tiles that are far away (close to * the horizon) will be culled when this flag is enabled. * - * Note that this will always be disabled if UseLodTransitions is set to true. + * Note that this will always be disabled if Enable Lod Transitions is set to + * true. */ UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Cesium|Tile Culling", - Meta = (EditCondition = "!UseLodTransitions", EditConditionHides)) + Meta = (EditCondition = "!EnableLodTransitions", EditConditionHides)) bool EnableFogCulling = true; /** @@ -616,29 +618,34 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { FCompletedLoadTrigger OnTilesetLoaded; /** - * Use a dithering effect when transitioning between tiles of different LODs. + * Whether to enable a dithering effect when transitioning between tiles of + * different LODs. * * When this is set to true, Frustrum Culling and Fog Culling are always * disabled. + * + * When Forward Rendering is enabled for the project, LOD transitions are + * only compatible when used with temporal anti-aliasing methods. Setting this + * to true for other methods will result in dithering artifacts. */ UPROPERTY( EditAnywhere, - BlueprintGetter = GetUseLodTransitions, - BlueprintSetter = SetUseLodTransitions, + BlueprintGetter = GetEnableLodTransitions, + BlueprintSetter = SetEnableLodTransitions, Category = "Cesium|Rendering") - bool UseLodTransitions = false; + bool EnableLodTransitions = false; /** - * How long dithered LOD transitions between different tiles should take, in + * How long the LOD transitions between different tiles should take, in * seconds. * - * Only relevant if UseLodTransitions is true. + * Only relevant if Enable Lod Transitions is true. */ UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Cesium|Rendering", - meta = (EditCondition = "UseLodTransitions", EditConditionHides)) + meta = (EditCondition = "EnableLodTransitions", EditConditionHides)) float LodTransitionLength = 0.5f; private: @@ -904,10 +911,10 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { float GetLoadProgress() const { return LoadProgress; } UFUNCTION(BlueprintGetter, Category = "Cesium") - bool GetUseLodTransitions() const { return UseLodTransitions; } + bool GetEnableLodTransitions() const { return EnableLodTransitions; } UFUNCTION(BlueprintSetter, Category = "Cesium") - void SetUseLodTransitions(bool InUseLodTransitions); + void SetEnableLodTransitions(bool InEnableLodTransitions); UFUNCTION(BlueprintGetter, Category = "Cesium") ETilesetSource GetTilesetSource() const { return TilesetSource; } @@ -1207,7 +1214,7 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { bool _beforeMoviePreloadAncestors; bool _beforeMoviePreloadSiblings; int32_t _beforeMovieLoadingDescendantLimit; - bool _beforeMovieUseLodTransitions; + bool _beforeMovieEnableLodTransitions; bool _scaleUsingDPI;