Skip to content

Commit

Permalink
Merge pull request #1539 from CesiumGS/ue55
Browse files Browse the repository at this point in the history
Get the plugin working in UE 5.5 Preview.
  • Loading branch information
j9liu authored Nov 26, 2024
2 parents 41fee73 + dbe14b0 commit c7db043
Show file tree
Hide file tree
Showing 51 changed files with 579 additions and 168 deletions.
118 changes: 118 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,121 @@ jobs:
test-package-base-name: "CesiumForUnreal-54"
visual-studio-version: "2022"
visual-studio-components: "Microsoft.VisualStudio.Component.VC.14.34.17.4.x86.x64,Microsoft.VisualStudio.Component.Windows10SDK.18362"
Windows55:
uses: ./.github/workflows/buildWindows.yml
secrets: inherit
with:
runner-label: "windows-2022"
unreal-engine-version: "5.5.0"
unreal-engine-zip: "s3://cesium-unreal-engine/5.5.0/UE_5.5.zip"
unreal-program-name: "UE_5.5"
upload-package-base-name: "CesiumForUnreal-55-windows"
# These are specified in the Unreal Engine release notes under "IDE Version the Build farm compiles against"
# and using them ensures we're compiling our plugin in the exact same way that Unreal Engine itself is compiled.
cmake-generator: "Visual Studio 17 2022"
cmake-toolchain: "version=14.38"
cmake-platform: "x64,version=10.0.22621.0"
visual-studio-version: "2022"
visual-studio-components: "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64,Microsoft.VisualStudio.Component.Windows11SDK.22621"
TestWindows55:
needs: [Windows55]
uses: ./.github/workflows/testWindows.yml
secrets: inherit
with:
runner-label: windows-2022
unreal-engine-zip: "s3://cesium-unreal-engine/5.5.0/UE_5.5.zip"
unreal-program-name: "UE_5.5"
test-package-base-name: "CesiumForUnreal-55-windows"
Android55:
uses: ./.github/workflows/buildAndroid.yml
secrets: inherit
with:
runner-label: windows-2022
unreal-engine-version: "5.5.0"
unreal-engine-zip: "s3://cesium-unreal-engine/5.5.0/UE_5.5.zip"
unreal-program-name: "UE_5.5"
upload-package-base-name: "CesiumForUnreal-55-android"
android-ndk-version: "r25b"
Linux55:
uses: ./.github/workflows/buildLinux.yml
secrets: inherit
with:
runner-label: ubuntu-22.04
unreal-engine-version: "5.5.0"
unreal-engine-zip: "s3://cesium-unreal-engine/5.5.0/Linux_Unreal_Engine_5.5.0.zip"
unreal-program-name: "UE_5.5"
upload-package-base-name: "CesiumForUnreal-55-linux"
clang-version: "v23_clang-18.1.0-rockylinux8"
Apple55:
uses: ./.github/workflows/buildApple.yml
secrets: inherit
with:
runner-label: macos-14
unreal-engine-version: "5.5.0"
unreal-engine-zip: "s3://cesium-unreal-engine/5.5.0/UE_55_macOS.zip"
unreal-program-name: "UE_5.5"
upload-package-base-name: "CesiumForUnreal-55-apple"
xcode-version: "15.4"
Combine55:
runs-on: ubuntu-latest
needs: [Windows55, Android55, Linux55, Apple55]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set environment variables
run: |
export CESIUM_UNREAL_VERSION=$GITHUB_REF_NAME
export BUILD_CESIUM_UNREAL_PACKAGE_NAME="CesiumForUnreal-55-${CESIUM_UNREAL_VERSION}"
export BUILD_CESIUM_UNREAL_SOURCE_ONLY_PACKAGE_NAME="CesiumForUnreal-55-SourceOnly-${CESIUM_UNREAL_VERSION}"
# Make these available to subsequent steps
echo "CESIUM_UNREAL_VERSION=$CESIUM_UNREAL_VERSION" >> $GITHUB_ENV
echo "BUILD_CESIUM_UNREAL_PACKAGE_NAME=$BUILD_CESIUM_UNREAL_PACKAGE_NAME" >> $GITHUB_ENV
echo "BUILD_CESIUM_UNREAL_SOURCE_ONLY_PACKAGE_NAME=$BUILD_CESIUM_UNREAL_SOURCE_ONLY_PACKAGE_NAME" >> $GITHUB_ENV
- name: Download Apple build
uses: actions/download-artifact@v4
with:
name: CesiumForUnreal-55-apple-${{ env.CESIUM_UNREAL_VERSION}}
path: combine
- name: Download Android build
uses: actions/download-artifact@v4
with:
name: CesiumForUnreal-55-android-${{ env.CESIUM_UNREAL_VERSION}}
path: combine
- name: Download Linux build
uses: actions/download-artifact@v4
with:
name: CesiumForUnreal-55-linux-${{ env.CESIUM_UNREAL_VERSION}}
path: combine
- name: Download Windows build
uses: actions/download-artifact@v4
with:
name: CesiumForUnreal-55-windows-${{ env.CESIUM_UNREAL_VERSION}}
path: combine
- name: Publish combined package artifact
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_CESIUM_UNREAL_PACKAGE_NAME}}
path: combine
- name: Publish combined package artifact for the Unreal Marketplace
if: ${{ success() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_CESIUM_UNREAL_SOURCE_ONLY_PACKAGE_NAME}}
path: |
combine
# These are built by Epic, and including them seems to confuse their process.
!combine/CesiumForUnreal/Binaries/**/*
!combine/CesiumForUnreal/Intermediate/**/*
TestPackage55:
needs: [Combine55]
uses: ./.github/workflows/testPackageOnWindows.yml
secrets: inherit
with:
runner-label: windows-2022
unreal-engine-zip: "s3://cesium-unreal-engine/5.5.0/UE_5.5.zip"
unreal-program-name: "UE_5.5"
unreal-engine-association: "5.5"
test-package-base-name: "CesiumForUnreal-55"
visual-studio-version: "2022"
visual-studio-components: "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64,Microsoft.VisualStudio.Component.Windows11SDK.22621"
15 changes: 9 additions & 6 deletions .github/workflows/buildApple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ jobs:
build:
runs-on: ${{ inputs.runner-label }}
steps:
- name: Customize BuildConfiguration.xml
run: |
mkdir -p ~/.config/Unreal\ Engine/UnrealBuildTool
# - We limit parallel actions because our builds use a lot more memory than UBT thinks they will.
# - We set the source code control Provider to None so UBT includes all files in the unity build.
printf '<?xml version="1.0" encoding="utf-8" ?>\n<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">\n <BuildConfiguration>\n <MaxParallelActions>2</MaxParallelActions>\n </BuildConfiguration>\n <SourceFileWorkingSet><Provider>None</Provider></SourceFileWorkingSet>\n</Configuration>\n' > ~/.config/Unreal\ Engine/UnrealBuildTool/BuildConfiguration.xml
# In UE 5.5, UBT apparently loads from ~/Documents instead of ~/.config
mkdir -p ~/Documents/Unreal\ Engine/UnrealBuildTool
cp ~/.config/Unreal\ Engine/UnrealBuildTool/BuildConfiguration.xml ~/Documents/Unreal\ Engine/UnrealBuildTool/BuildConfiguration.xml
- name: Make some more disk space
run: |
df -h
Expand Down Expand Up @@ -121,12 +130,6 @@ jobs:
- name: Remove extern directory
run: |
rm -rf extern
- name: Customize BuildConfiguration.xml
run: |
mkdir -p ~/.config/Unreal\ Engine/UnrealBuildTool
# - We limit parallel actions because our builds use a lot more memory than UBT thinks they will.
# - We set the source code control Provider to None so UBT includes all files in the unity build.
printf '<?xml version="1.0" encoding="utf-8" ?>\n<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">\n <BuildConfiguration>\n <MaxParallelActions>2</MaxParallelActions>\n </BuildConfiguration>\n <SourceFileWorkingSet><Provider>None</Provider></SourceFileWorkingSet>\n</Configuration>\n' > ~/.config/Unreal\ Engine/UnrealBuildTool/BuildConfiguration.xml
- name: Build plugin for macOS and iOS
run: |
sed -i '' 's/\"EngineVersion\": \"5.2.0\"/\"EngineVersion\": \"${{ inputs.unreal-engine-version }}\"/g' CesiumForUnreal.uplugin
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/buildLinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ jobs:
sudo swapon --show
cat /proc/meminfo
apt list --installed
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
sudo snap list
- name: Removed unneeded packages to gain disk space
run: |
sudo apt update
sudo apt remove google-chrome-stable clang-13 clang-14 clang-15 llvm-13-dev llvm-13-linker-tools llvm-13-runtime llvm-13-tools llvm-13 llvm-14-dev llvm-14-linker-tools llvm-14-runtime llvm-14-tools llvm-14 llvm-15-dev llvm-15-linker-tools llvm-15-runtime llvm-15-tools llvm-15 x11-common xserver-common aspnetcore-runtime-6.0 aspnetcore-runtime-7.0 aspnetcore-runtime-8.0 aspnetcore-targeting-pack-6.0 aspnetcore-targeting-pack-7.0 aspnetcore-targeting-pack-8.0 docker-ce-cli docker-ce dotnet-apphost-pack-6.0 dotnet-apphost-pack-7.0 dotnet-apphost-pack-8.0 dotnet-host dotnet-hostfxr-6.0 dotnet-hostfxr-7.0 dotnet-hostfxr-8.0 dotnet-runtime-6.0 dotnet-runtime-7.0 dotnet-runtime-8.0 dotnet-runtime-deps-6.0 dotnet-runtime-deps-7.0 dotnet-runtime-deps-8.0 dotnet-sdk-6.0 dotnet-sdk-7.0 dotnet-sdk-8.0 dotnet-targeting-pack-6.0 dotnet-targeting-pack-7.0 dotnet-targeting-pack-8.0 eatmydata emacsen-common firebird3.0-common-doc firebird3.0-common firefox kubectl mercurial-common mercurial microsoft-edge-stable mssql-tools mysql-client-8.0 mysql-client-core-8.0 mysql-client mysql-common mysql-server-8.0 php8.1 postgresql-14
sudo apt remove google-chrome-stable clang-13 clang-14 clang-15 llvm-13-dev llvm-13-linker-tools llvm-13-runtime llvm-13-tools llvm-13 llvm-14-dev llvm-14-linker-tools llvm-14-runtime llvm-14-tools llvm-14 llvm-15-dev llvm-15-linker-tools llvm-15-runtime llvm-15-tools llvm-15 x11-common xserver-common aspnetcore-runtime-6.0 aspnetcore-runtime-7.0 aspnetcore-runtime-8.0 aspnetcore-targeting-pack-6.0 aspnetcore-targeting-pack-7.0 aspnetcore-targeting-pack-8.0 docker-ce-cli docker-ce dotnet-apphost-pack-6.0 dotnet-apphost-pack-7.0 dotnet-apphost-pack-8.0 dotnet-host dotnet-hostfxr-6.0 dotnet-hostfxr-7.0 dotnet-hostfxr-8.0 dotnet-runtime-6.0 dotnet-runtime-7.0 dotnet-runtime-8.0 dotnet-runtime-deps-6.0 dotnet-runtime-deps-7.0 dotnet-runtime-deps-8.0 dotnet-sdk-6.0 dotnet-sdk-7.0 dotnet-sdk-8.0 dotnet-targeting-pack-6.0 dotnet-targeting-pack-7.0 dotnet-targeting-pack-8.0 eatmydata emacsen-common firebird3.0-common-doc firebird3.0-common firefox kubectl mercurial-common mercurial microsoft-edge-stable mssql-tools mysql-client-8.0 mysql-client-core-8.0 mysql-client mysql-common mysql-server-8.0 php8.1 postgresql-14 azure-cli microsoft-edge-stable google-cloud-cli temurin-21-jdk temurin-17-jdk temurin-11-jdk temurin-8-jdk powershell google-cloud-cli-anthoscli mysql-server-core-8.0 containerd.io libllvm15 libllvm14 libllvm13 mono-devel libclang-common-15-dev libclang-common-14-dev libclang-common-13-dev
df -h
- name: Create some space to work in /mnt
run: |
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

### ? - 2024-12-02

This is the last release of Cesium for Unreal that will support Unreal Engine v5.2. Future versions will require Unreal Engine v5.3+.

##### Additions :tada:

- Added support for Unreal Engine 5.5.
- Added a "From Ellipsoid" option to `Cesium3DTileset` to generate a tileset by tesselating the surface of the ellipsoid, producing a simple globe tileset without terrain features.

##### Fixes :wrench:
Expand Down
64 changes: 52 additions & 12 deletions Shaders/Private/CesiumPointAttenuationVertexFactory.ush
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
CesiumPointAttenuationVertexFactory.ush: point attenuation vertex factory shader code.
=============================================================================*/

#ifndef ENGINE_VERSION_5_4_OR_HIGHER
#define ENGINE_VERSION_5_4_OR_HIGHER 0
#endif

#ifndef ENGINE_VERSION_5_5_OR_HIGHER
#define ENGINE_VERSION_5_5_OR_HIGHER 0
#endif

#include "/Engine/Private/Common.ush"
#include "/Engine/Private/VertexFactoryCommon.ush"

Expand Down Expand Up @@ -40,7 +48,7 @@ struct FVertexFactoryInput
#endif
};

/**
/**
* Per-vertex inputs. Used by passes with a trimmed down position-only shader.
*/
struct FPositionOnlyVertexFactoryInput
Expand All @@ -54,7 +62,7 @@ struct FPositionOnlyVertexFactoryInput
#endif
};

/**
/**
* Per-vertex inputs. Used by passes with a trimmed down position-and-normal-only shader.
*/
struct FPositionAndNormalOnlyVertexFactoryInput
Expand Down Expand Up @@ -83,7 +91,7 @@ struct FVertexFactoryIntermediates
half TangentToWorldSign;

half4 Color;

/** Cached primitive and instance data */
FSceneDataIntermediates SceneData;
};
Expand Down Expand Up @@ -119,15 +127,15 @@ half3x3 CalculateTangentToLocal(uint PointIndex, out float TangentSign)
{
half3 TangentInputX = PackedTangentsBuffer[2 * PointIndex + 0].xyz;
half4 TangentInputZ = PackedTangentsBuffer[2 * PointIndex + 1].xyzw;

half3 TangentX = TangentBias(TangentInputX);
half4 TangentZ = TangentBias(TangentInputZ);

TangentSign = TangentZ.w;

// Derive the binormal by getting the cross product of the normal and tangent
half3 TangentY = cross(TangentZ.xyz, TangentX) * TangentZ.w;

// Recalculate TangentX off of the other two vectors
// This corrects quantization errors since TangentX was passed in as a quantized vertex input
half3x3 Result;
Expand Down Expand Up @@ -158,7 +166,7 @@ FVertexFactoryIntermediates GetVertexFactoryIntermediates(FVertexFactoryInput In
{
FVertexFactoryIntermediates Intermediates = (FVertexFactoryIntermediates)0;
Intermediates.SceneData = VF_GPUSCENE_GET_INTERMEDIATES(Input);

uint PointIndex = Input.VertexId / 4;
uint CornerIndex = Input.VertexId - (PointIndex * 4);

Expand Down Expand Up @@ -213,19 +221,19 @@ FVertexFactoryInterpolantsVSToPS VertexFactoryGetInterpolantsVSToPS(
Interpolants.TangentToWorld0 = float4(Intermediates.TangentToWorld[0], 0);
Interpolants.TangentToWorld2 = float4(Intermediates.TangentToWorld[2], Intermediates.TangentToWorldSign);
Interpolants.Color = Intermediates.Color;

#if NUM_TEX_COORD_INTERPOLATORS
float2 CustomizedUVs[NUM_TEX_COORD_INTERPOLATORS];
GetMaterialCustomizedUVs(VertexParameters, CustomizedUVs);
GetCustomInterpolators(VertexParameters, CustomizedUVs);

UNROLL
for (int CoordinateIndex = 0; CoordinateIndex < NUM_TEX_COORD_INTERPOLATORS; CoordinateIndex++)
{
SetUV(Interpolants, CoordinateIndex, CustomizedUVs[CoordinateIndex]);
}
#endif

#if INSTANCED_STEREO
Interpolants.EyeIndex = 0;
#endif
Expand Down Expand Up @@ -253,6 +261,13 @@ float4 VertexFactoryGetWorldPosition(FPositionAndNormalOnlyVertexFactoryInput In
return GetWorldPosition(Input.VertexId);
}

// local position relative to instance
float3 VertexFactoryGetInstanceSpacePosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
// No support for instancing, so instance == primitive
return Intermediates.Position;
}

float3 VertexFactoryGetWorldNormal(FPositionAndNormalOnlyVertexFactoryInput Input)
{
float3 PointNormal = GetPointNormal(Input.VertexId);
Expand All @@ -275,6 +290,13 @@ float4 VertexFactoryGetPreviousWorldPosition(FVertexFactoryInput Input, FVertexF
#endif
}

// local position relative to instance
float3 VertexFactoryGetPreviousInstanceSpacePosition(FVertexFactoryInput Input, FVertexFactoryIntermediates Intermediates)
{
// No support for instancing, so instance == primitive
return Intermediates.Position;
}

float4 ApplyAttenuation(float4 WorldPosition, uint CornerIndex) {
// These offsets generate the quad like so:
// 1 --- 2
Expand Down Expand Up @@ -333,10 +355,24 @@ FMaterialVertexParameters GetMaterialVertexParameters(
FVertexFactoryInput Input,
FVertexFactoryIntermediates Intermediates,
float3 WorldPosition,
half3x3 TangentToLocal)
half3x3 TangentToLocal,
bool bIsPreviousFrame = false)
{
#if ENGINE_VERSION_5_5_OR_HIGHER
FMaterialVertexParameters Result = MakeInitializedMaterialVertexParameters();
if (bIsPreviousFrame)
{
Result.PositionInstanceSpace = VertexFactoryGetPreviousInstanceSpacePosition(Input, Intermediates);
}
else
{
Result.PositionInstanceSpace = VertexFactoryGetInstanceSpacePosition(Input, Intermediates);
}
Result.PositionPrimitiveSpace = Result.PositionInstanceSpace; // No support for instancing, so instance == primitive
#else
FMaterialVertexParameters Result = (FMaterialVertexParameters)0;

#endif

Result.SceneData = Intermediates.SceneData;
Result.WorldPosition = WorldPosition;
Result.TangentToWorld = Intermediates.TangentToWorld;
Expand All @@ -354,6 +390,10 @@ FMaterialVertexParameters GetMaterialVertexParameters(
}
#endif

#if ENGINE_VERSION_5_4_OR_HIGHER
Result.LWCData = MakeMaterialLWCData(Result);
#endif

return Result;
}

Expand Down Expand Up @@ -439,7 +479,7 @@ FVertexFactoryRayTracingInterpolants VertexFactoryInterpolate(
float bInterp)
{
FVertexFactoryRayTracingInterpolants O;

INTERPOLATE_MEMBER(InterpolantsVSToPS.TangentToWorld0.xyz);
INTERPOLATE_MEMBER(InterpolantsVSToPS.TangentToWorld2);

Expand Down
3 changes: 0 additions & 3 deletions Source/CesiumRuntime/Private/Cesium3DTileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2178,9 +2178,6 @@ void ACesium3DTileset::Tick(float DeltaTime) {
updateTilesetOptionsFromProperties();

std::vector<FCesiumCamera> cameras = this->GetCameras();
if (cameras.empty()) {
return;
}

glm::dmat4 ueTilesetToUeWorld =
VecMath::createMatrix4D(this->GetActorTransform().ToMatrixWithScale());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,5 @@ UCesiumBingMapsRasterOverlay::CreateOverlay(
TCHAR_TO_UTF8(*this->BingMapsKey),
mapStyle,
"",
CesiumGeospatial::Ellipsoid::WGS84,
options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,13 @@ EncodedPropertyTable encodePropertyTableAnyThreadPart(
CesiumEncodedMetadataParseColorFromString::encode(
*pDescription,
property,
gsl::span(pImage->pixelData),
std::span(pImage->pixelData),
encodedFormat.bytesPerChannel * encodedFormat.channels);
} else /* info.Conversion == ECesiumEncodedMetadataConversion::Coerce */ {
CesiumEncodedMetadataCoerce::encode(
*pDescription,
property,
gsl::span(pImage->pixelData),
std::span(pImage->pixelData),
encodedFormat.bytesPerChannel * encodedFormat.channels);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Templates/SharedPointer.h"
#include "Templates/UniquePtr.h"
#include <CesiumGltf/KhrTextureTransform.h>
#include <array>
#include <variant>

struct FCesiumFeatureIdSet;
Expand Down
Loading

0 comments on commit c7db043

Please sign in to comment.