CesiumGS / cesium-unreal

Bringing the 3D geospatial ecosystem to Unreal Engine
https://cesium.com/platform/cesium-for-unreal/
Apache License 2.0
916 stars 292 forks source link

Fix tiles on edges of frustum disappearing (UE.5.3) #1307

Closed csciguy8 closed 9 months ago

csciguy8 commented 9 months ago

Closes #1303.

Explicitly set the value of AspectRatioAxisConstraint to AspectRatio_MaintainXFOV. Our code in ACesium3DTileset::CreateViewStateFromViewParameters assumes horizontal field of view is constant, and vertical field of view is calculated from this.

This fixes a bug where the editor viewport did not match the viewport you would see when entering Play-in-Editor mode or when running a packaged game. It's noticeable whenever the aspect ratio is > 1.0, and in extreme cases, tiles might not show up around the edges of the view. Basically, the Unreal Engine viewport was wider than our tile selection code expected.

In Unreal Engine v5.2, the default was AspectRatio_MaintainXFOV. In Unreal Engine v5.3, the default is now AspectRatio_MaintainYFOV. This change caused the issue.

image

cesium-concierge commented 9 months ago

Thanks for the pull request @csciguy8!

Reviewers, don't forget to make sure that:

kring commented 9 months ago

As discussed offline, I think it would be better to add support for the new setting, rather than reverting it. #1310 covers that. In the meantime, though, this PR is a big improvement over the incorrect tile selection that we get otherwise. Thanks @csciguy8!