Skip to content
7 changes: 6 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions Config/Engine.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Binary file modified Content/Materials/Layers/ML_DitherFade.uasset
Binary file not shown.
22 changes: 11 additions & 11 deletions Source/CesiumRuntime/Private/Cesium3DTileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ ACesium3DTileset::ACesium3DTileset()
_beforeMoviePreloadAncestors{PreloadAncestors},
_beforeMoviePreloadSiblings{PreloadSiblings},
_beforeMovieLoadingDescendantLimit{LoadingDescendantLimit},
_beforeMovieUseLodTransitions{true},
_beforeMovieEnableLodTransitions{true},

_tilesetsBeingDestroyed(0) {

Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -442,21 +442,21 @@ 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() {
this->_captureMovieMode = false;
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(); }
Expand Down Expand Up @@ -1819,7 +1819,7 @@ void ACesium3DTileset::updateTilesetOptionsFromProperties() {
options.enforceCulledScreenSpaceError = this->EnforceCulledScreenSpaceError;
options.culledScreenSpaceError =
static_cast<double>(this->CulledScreenSpaceError);
options.enableLodTransitionPeriod = this->UseLodTransitions;
options.enableLodTransitionPeriod = this->EnableLodTransitions;
options.lodTransitionLength = this->LodTransitionLength;
// options.kickDescendantsWhileFadingIn = false;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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 :
Expand Down Expand Up @@ -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) ||
Expand Down
13 changes: 10 additions & 3 deletions Source/CesiumRuntime/Private/CesiumGltfComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -3147,7 +3154,7 @@ static void loadPrimitiveGameThreadPart(
1.0f);
pMaterial->SetScalarParameterValueByInfo(
FMaterialParameterInfo(
"FadingType",
"FadeDirection",
EMaterialParameterAssociation::LayerParameter,
fadeLayerIndex),
0.0f);
Expand Down
35 changes: 21 additions & 14 deletions Source/CesiumRuntime/Public/Cesium3DTileset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;

/**
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -1207,7 +1214,7 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor {
bool _beforeMoviePreloadAncestors;
bool _beforeMoviePreloadSiblings;
int32_t _beforeMovieLoadingDescendantLimit;
bool _beforeMovieUseLodTransitions;
bool _beforeMovieEnableLodTransitions;

bool _scaleUsingDPI;

Expand Down