Cesium for Unreal v2.0 Upgrade Guide
Many systems in Cesium for Unreal received substantial updates in version 2.0 that modified their existing interfaces and workflows. Some updates include fundamental differences that can potentially break older projects, despite efforts to add backward compatibility. This guide targets experienced users and aims to clarify the changes in Cesium for Unreal v2.0. Be sure to make a backup of your project before switching Cesium for Unreal versions.
If you are not already experienced with the plugin, check out the other Cesium for Unreal learning content instead!
In Cesium for Unreal, georeferenced sub-levels are used to develop scenes in multiple locations across the globe. They provide geospatial context for the local environment while ensuring that the scene's contents are not affected by large user movements. Sub-levels were previously made possible through the World Composition system, which has been deprecated in favor of other level streaming systems in Unreal Engine 5. If you had the Enable World Composition setting active in your Cesium for Unreal projects, feel free to disable it, as it is no longer used to support the sub-level system in Cesium for Unreal.
A sub-level in Cesium for Unreal v2.0 is represented by a LevelInstance actor containing a CesiumSubLevel component. Similar to CesiumGeoreference, the CesiumSubLevel component defines a sub-level origin to position its contents relative to the globe. It also defines a load radius, which is a distance threshold that when crossed, allows the sub-level to be activated. Only one sub-level may be active at a time, both in runtime and in the Editor.
For a step-by-step guide on how to create sub-levels from scratch, check out the Building Global Scenes with Georeferenced Sublevels tutorial.
After you upgrade to Cesium for Unreal v2.0, the plugin will attempt to upgrade any sub-levels saved with an older version of the plugin. Once a persistent level is opened in the Editor, the plugin automatically finds and converts older sub-levels into LevelInstance actors, each with a CesiumSubLevel component attached.
You can verify that the sub-levels were upgraded successfully in the Outliner panel. The LevelInstance's contents will appear as children.
Make sure that all of your sub-levels have been correctly upgraded. Then, save the persistent level to keep the changes.
In older versions of Cesium for Unreal, adding a 3D Tileset to a sub-level would cause new CesiumGeoreference and CesiumCreditSystem actors to spawn. The duplication of these actors could lead to errors, such as UI overlap with multiple credit systems. With the new sub-level system, any 3D Tilesets that are added to sub-levels will not create new CesiumGeoreference or CesiumCreditSystem instances. However, if any duplicates were saved in an old sub-level, they will not be removed during the upgrade process.
It is possible to have multiple CesiumGeoreference actors in an application, and can be useful for managing different instances of a globe. This step addresses cases where the extra CesiumGeoreference was not intentionally created.
To delete these extraneous Cesium actors, follow the steps below:
1Select the target LevelInstance in the Outliner panel. In the Details panel, click Edit.
2For every Cesium3DTileset actor in the sub-level, inspect its Georeference and Credit System fields in the Details panel. If you see references to those duplicate actors in the aforementioned fields, remove them. Once these references are removed, your 3D Tileset’s settings should appear similar to the image below:
3Once you are sure that none of your Cesium3DTilesets reference the duplicate CesiumGeoreference or CesiumCreditSystem, you may delete those actors.
You can delete them by selecting the actors in the Outliner and pressing the Delete key, or by right-clicking the selection and clicking Edit > Delete in the drop-down menu.
If you forget to clear all of the references to the CesiumGeoreference or CesiumCreditSystem, you will see an alert window when you try to delete them. Do not ignore this popup. Deleting the actors while they are still referenced in the sub-level can lead to major errors.
4When you are done with your changes, select the LevelInstance actor again and click Commit Changes in the Details panel.
After these changes, any 3D Tilesets loaded by the sub-level will resolve their Georeference and Credit System references to the existing actors in the persistent level.
Previous versions of Cesium for Unreal were built around EXT_feature_metadata
, a draft extension that was deprecated in the 3D Tiles 1.1 specification. In Cesium for Unreal v2.0, models with the extension will still load, but their feature IDs and metadata will no longer be accessible. Metadata picking and styling with EXT_feature_metadata
are no longer supported.
Instead, Cesium for Unreal v2.0 supports the EXT_mesh_features
and EXT_structural_metadata
extensions, which allow the definition of mesh features and metadata respectively on glTF models. Between these extensions and the deprecated EXT_feature_metadata
, there were fundamental changes that required an overhaul of the Cesium for Unreal Blueprint API, complicating backward compatibility with older plugin versions. The following sections clarify differences between the old and new metadata systems. These are written more briefly, like a changelog, and assume familiarity with the existing API.
If you are new to metadata in Cesium for Unreal, or if you would like a more extensive guide on the new metadata API, visit the Features and Metadata Technical Reference instead.
For additional context about these changes, you can find the complete EXT_mesh_features
specification here.
In 3D Tiles 1.1, feature IDs are indicated by the EXT_mesh_features
extension, which can exist independently of EXT_structural_metadata
. The extension is represented in Blueprints by the CesiumPrimitiveFeatures struct and allows access to the feature ID sets on the glTF primitive. This means that CesiumMetadataPrimitive, which represented the outdated primitive EXT_feature_metadata
extension, is now deprecated.
For projects that used the older API, note these changes:
- If you were using Get Primitive Metadata to get the
EXT_feature_metadata
extension from a primitive, use Get Primitive Features instead. - If you were using Get Feature Texture Names, see the Primitive Metadata section for how to interact with property textures in the new API.
- Get Feature ID Attributes and Get Feature ID Textures have been deprecated. Use Get Feature ID Sets Of Type instead.
- Get First Vertex ID From Face ID has been deprecated. Use Get First Vertex From Face.
Feature ID sets may be accessed in Blueprints via the CesiumFeatureIdSet struct. A feature ID set has a ECesiumFeatureIdSetType indicating whether it is a feature ID attribute, a feature ID texture, or a set of implicit feature IDs. Feature IDs may be retrieved from feature ID sets with the Get Feature ID For Vertex and Get Feature ID From Hit functions, regardless of type.
If a CesiumFeatureIdSet is a feature ID attribute, the Get As Feature ID Attribute Blueprint can be used to interact with the underlying CesiumFeatureIdAttribute. Similarly, if a CesiumFeatureIdSet is a feature ID texture, Get As Feature ID Texture may be used.
Previously, a feature ID attribute or texture would not indicate that it was somehow broken, and thus unable to return accurate feature IDs. For example, if the image of a feature ID texture did not actually exist, nothing in the Cesium for Unreal API would communicate that. The ECesiumFeatureIdAttributeStatus and ECesiumFeatureIdTextureStatus enums were added to indicate situations where something in a feature ID set is invalid. These statuses can be queried using the Get Feature ID Attribute Status and Get Feature ID Texture Status nodes respectively.
The Get Texture Coordinate Index node has been renamed to Get Unreal UV Channel. This Blueprint retrieves the UV channel used by a CesiumFeatureIdTexture in its primitive. The documentation incorrectly claimed that the Blueprint returned the texture coordinate set index in the glTF primitive; this is not necessarily equal to the UV channel it uses in the Unreal Engine mesh. A separate Blueprint named Get Gltf Texture Coordinate Set Index has been added to retrieve the index of the texture coordinate set in the glTF.
Finally, the Get Feature Table Name Blueprint has been deprecated for both CesiumFeatureIdAttribute and CesiumFeatureIdTexture. Instead, use Get Property Table Index on a CesiumFeatureIdSet to retrieve the index of the property table it uses.
For additional context about these changes, you can find the complete EXT_structural_metadata
specification here.
Building on the EXT_feature_metadata
specification, EXT_structural_metadata
adds new types and options to define metadata properties with more granularity. These additions required a rework of the metadata system in Cesium for Unreal, which may complicate backwards compatibility.
Previous versions of Cesium for Unreal denoted the type of a metadata property or value with the ECesiumMetadataTrueType enum. However, the metadata types in EXT_structural_metadata
are more complex and have too many permutations to reasonably define in a single enum. Therefore, the ECesiumMetadataTrueType enumhas been deprecated in Cesium for Unreal v2.0. Instead, the type of a metadata property or value is conveyed through the CesiumMetadataValueType struct. CesiumMetadataValueType is closely modeled after the way property type information appears in the extension itself.
A CesiumMetadataValueType has three components:
- Type, indicated by ECesiumMetadataType. This enum corresponds to the
type
of a class property in the metadata schema. - ComponentType, indicated by ECesiumMetadataComponentType. This enum corresponds to the
componentType
of a class property. This is only applicable to scalar,VECN
, andMATN
types, and will be markedNone
for all other types. - Is Array, a boolean that corresponds to the
array
flag in a class property. If true, the type represents an array of elements, where the elements are of the given type and component type.
The table below demonstrates how to convert values from the older ECesiumMetadataTrueType enum to their new CesiumMetadataValueType representations.
ECesiumMetadataTrueType | Type | Component Type | Is Array |
---|---|---|---|
Int8 | Scalar | Int8 | False |
Float32 | Scalar | Float32 | False |
String | String | None | False |
The ECesiumMetadataTrueType enum also included an Array value, which would indicate that a property contained array metadata values. However, this required a second ECesiumMetadataTrueType value to indicate the actual type of the array elements. For CesiumMetadataValueType, array types are simply conveyed by the Is Array boolean. The array element type is already indicated by the Type and Component Type properties.
The table below illustrates the equivalency of array metadata types between the older ECesiumMetadataTrueType enum and the new CesiumMetadataValueType representation.
ECesiumMetadataTrueType | Type | Component Type | Is Array |
---|---|---|---|
Array of Uint16 | Scalar | Uint16 | True |
Array of Boolean | Boolean | None | True |
The ECesiumMetadataBlueprintType enum is used by the plugin to indicate the best-fitting Blueprints type for a metadata property or value. Given the new metadata types possible with the EXT_structural_metadata
extension, the enum has been expanded in Cesium for Unreal v2.0 to include the additional vector and matrix types. Many of these types do not have an exact representation in Blueprints, but they can be converted to a sufficiently compatible Blueprint type.
The newly supported Blueprint types include:
- IntPoint
- Vector2D
- IntVector
- Vector3f
- Vector
- Vector4
- Matrix
Vector property values can be converted to other dimensions for flexibility. For example, a VEC2
value can be returned as a Vector4 with zeroes in the unused components. A VEC3
can be returned as a Vector2D containing the first two components. Scalars may also be retrieved in vector form, where the vector has the scalar value in all components. These examples are shown below:
Original | Converted |
---|---|
vec2(1, 2) | As a Vector: (1, 2, 0) |
vec3(1, 2, 3) | As a Vector2D: (1, 2) |
2.5 | As a Vector4: (2.5, 2.5, 2.5, 2.5) |
Unfortunately, there are no perfect representations for MAT2
or MAT3
properties in Unreal Engine, but they can still be retrieved from properties as 4x4 Matrix instances. The actual property values will be padded with zeros in the unused components. This is illustrated by the following image:
Additionally, scalars can be retrieved as a Matrix with the value along its diagonal. For example:
Keep in mind that while matrices are column-major in EXT_structural_metadata, a Matrix in Unreal Engine is row-major. The metadata values will be transposed to the correct places in the Matrix.
In previous versions of Cesium for Unreal, the CesiumMetadataGenericValue struct acted as a container for metadata values, representing them in an abstracted form. This enabled generalized behavior on the values of various metadata properties, regardless of their underlying type. In Cesium for Unreal v2.0, the name of this struct has been shortened to CesiumMetadataValue, but its function remains the same.
For projects that used the older API, note these changes:
- Get True Type and Get True Component Type have been deprecated. Use Get Value Type instead to retrieve type information as a condensed CesiumMetadataValueType.
- Get Blueprint Component Type has been renamed to Get Array Element Blueprint Type.
Additionally, the following Blueprint functions have been added to retrieve the data of a CesiumMetadataValue as one of the new vector or matrix types:
- Get Int Point
- Get Vector2D
- Get Int Vector
- Get Vector3f
- Get Vector
- Get Vector4
- Get Matrix
A CesiumMetadataValue may also be empty, containing no value. Empty values are useful for indicating when metadata values do not exist or cannot be properly retrieved. To check whether a CesiumMetadataValue is empty, use the Is Empty Blueprint node.
Several Blueprint functions return a collection of CesiumMetadataValues mapped by name. The values can be converted to strings for on-screen display using the Get Values as Strings Blueprint.
Metadata properties may have an array type in which its values are arrays of same-type elements. In previous versions of Cesium for Unreal, a metadata array value would be represented by the CesiumMetadataArray struct. Although the array elements had an underlying type, values would have to be retrieved with a specific Blueprint type. For example, integer values would be retrieved with Get Integer, and boolean values with Get Boolean.
In Cesium for Unreal v2.0, this struct has been renamed to CesiumPropertyArray. It still represents an array of metadata entities where values are retrieved by index. However, array elements are now retrieved with the Get Value Blueprint, which returns the value at the specified index as a CesiumMetadataValue. The actual type of this value can be found by using Get Value Type on the resulting CesiumMetadataValue, or Get Element Value Type on the CesiumPropertyArray it came from. Then, the value may be converted to the appropriate type via the CesiumMetadataValue API.
The addition of the generalized Get Value Blueprint results in the deprecation of the following Blueprints from the older CesiumMetadataArray:
- Get Boolean
- Get Byte
- Get Integer
- Get Integer64
- Get Float
- Get Float64
- Get String
Additionally, for older projects that used the CesiumMetadataArray API, note these changes:
- Get True Component Type has been deprecated. Use Get Element Value Type to get the type information as a CesiumMetadataValueType instead.
- Get Blueprint Component Type has been renamed to Get Element Blueprint Type.
- Get Size has been renamed to Get Array Size.
Property tables in EXT_structural_metadata
are derived from feature tables in the draft EXT_feature_metadata
extension. To reflect the new naming scheme, the CesiumFeatureTable struct has been renamed to CesiumPropertyTable, and CesiumMetadataProperty has been renamed to CesiumPropertyTableProperty for clarity.
The ECesiumPropertyTableStatus enum has been added to indicate whether a property table is valid. Invalid property tables will not contain any metadata properties. Additionally, a CesiumPropertyTableProperty can now report if it is valid using the ECesiumPropertyTablePropertyStatus enum. If the property has errors, it will appear as an empty property.
In previous versions of Cesium for Unreal, properties would be omitted from the property table if they were improperly defined in the glTF model. However, there was no distinction between whether the property was invalid (and therefore omitted), or whether it simply did not exist on the property table. Now, invalid properties will still show under the list of properties retrieved by Get Properties. The individual properties can be queried for their status.
Cesium for Unreal v2.0 also adds the Get Property Names Blueprint to retrieve the names of all properties, including invalid ones. The Find Property Blueprint will retrieve a property of a specific name from the property table, returning an invalid property instance if no property has that name.
Projects that used the older CesiumFeatureTable API should note these changes:
- Get Number Of Features has been renamed to Get Property Table Size.
- Get Metadata Values For Feature ID has been renamed to Get Metadata Values For Feature. Only values from valid properties will be retrieved.
- Get Metadata Values As String For Feature ID has been deprecated. Instead, Get Values As Strings to convert the output of Get Metadata Values For Feature.
As for CesiumPropertyTableProperty, it now supports all of the metadata types possible in EXT_structural_metadata
. The following Blueprint functions were added to retrieve values as the new vector and matrix types:
- Get Int Point
- Get Vector2D
- Get Int Vector
- Get Vector3f
- Get Vector
- Get Vector4
- Get Matrix
Finally, projects that used the older CesiumMetadataProperty API should note these changes:
- Get True Type and Get True Component Type have been deprecated. Use Get Value Type to get the type information as a CesiumMetadataValueType instead.
- Get Number Of Features has been renamed to Get Property Size.
- Get Component Count has been renamed to Get Array Size. Note that this will return zero if the property contains arrays that vary in length.
- Get Blueprint Component Type has been renamed to Get Array Element Blueprint Type.
The EXT_structural_metadata
specification introduces optional property transformations that can alter property values in some way. These transformations include offset
, scale
, noData
, and default
. A property of a numeric metadata type may also be normalized
and/or specify a min
and max
value. For the scope of this guide, the seven aforementioned items will be referred to as property qualifiers.
You may need to read the EXT_structural_metadata specification to understand what these qualifiers mean.
To retrieve the qualifiers of a property in Cesium for Unreal, use the corresponding Blueprint functions:
- Is Normalized
- Get Offset
- Get Scale
- Get No Data Value
- Get Default Value
- Get Minimum Value
- Get Maximum Value
Is Normalized will return true
for a normalized numeric property, and false
otherwise. All other functions return the values in CesiumMetadataValue form, which can later be converted to the appropriate type. If a property qualifier was not provided in the property’s definition, its corresponding function will return an empty CesiumMetadataValue.
There is also a new distinction between the raw values of a property and the transformed values of a property. Raw values are the values of the property stored as-is in the glTF buffers, while transformed values are the values after property transformations have been applied. The Get Value Blueprint will return the transformed value from a property, which may be empty if the property defines a noData
value. On the other hand, Get Raw Value will return the raw value without any property transformations.
If a property with a numeric metadata type is normalized
, Get Raw Value will return a CesiumMetadataValue containing the raw integer-component value, while Get Value returns the normalized value as a double-precision floating-point numbers.
In EXT_structural_metadata
, properties may be omitted from a property table if they are not marked as required. A metadata schema may specify a default
value for the optional property. If a property is omitted from a property table but has a default
value, it will be represented by a CesiumPropertyTableProperty with an Empty Property with Default status.
For these special properties:
- Get Value will return the default value regardless of feature ID.
- Get Raw Value will return an empty CesiumMetadataValue regardless of feature ID. (The property does not actually correspond to a buffer of raw values in the glTF.)
- All other “Get” functions will return the default value converted to the specified type.
Property textures in EXT_structural_metadata
are derived from feature textures in the draft EXT_feature_metadata
extension. To reflect the new naming scheme, CesiumFeatureTexture has been renamed to CesiumPropertyTexture, and CesiumFeatureTextureProperty has been renamed to CesiumPropertyTextureProperty accordingly.
Property textures themselves are relatively unchanged from previous versions of Cesium for Unreal. The only change to the existing API involves renaming the Get Property Keys function to Get Property Names. The Get Properties Blueprint has also been added for property textures, matching the function of the same name in the CesiumPropertyTable API.
The most dramatic changes from older versions of Cesium for Unreal involve the property texture property API. Previously, CesiumFeatureTextureProperty handled property values using specialized structs named CesiumIntegerColor and CesiumFloatColor, which held the channel values of a pixel from the property’s texture. Developers would have to determine the property's type, then manually construct the correct metadata value from the pixel. This proved to be an inconvenient and unintuitive way of retrieving metadata from property textures.
In Cesium for Unreal v2.0, CesiumPropertyTextureProperty has been reworked to handle the construction of values on the user’s behalf. It removes the need to interpret texture channels and simply returns the values as they are meant to be read. The Blueprints for CesiumPropertyTextureProperty heavily resemble the functions provided by the CesiumPropertyTableProperty API. However, because property texture properties support less metadata types, only a subset of the functions are available. This includes:
- Get Byte
- Get Integer
- Get Float
- Get Float64
- Get Int Point
- Get Vector2D
- Get Int Vector
- Get Vector
- Get Vector4
- Get Array
- Get Value
- Get Raw Value
All of the aforementioned functions use UV coordinates to retrieve the corresponding metadata value from the texture. UV coordinates may be supplied arbitrarily, or as intended from the glTF texture coordinate set that corresponds to the property. Similar to CesiumFeatureIdTexture, property texture properties had a Get Texture Coordinate Index Blueprint that has been renamed to Get Unreal UV Channel in v2.0. A separate Blueprint function, Get Gltf Texture Coordinate Set Index, can be used to retrieve the index of the texture coordinate set used by the property in the glTF.
Many other Blueprints have been added to retrieve the accurate type information of a CesiumPropertyTextureProperty, as well as its property qualifiers:
- Get Value Type
- Get Blueprint Type
- Get Array Element Blueprint Type
- Get Array Size
- Get Offset
- Get Scale
- Get Minimum Value
- Get Maximum Value
- Get No Data Value
- Get Default Value
All of the listed Blueprints are similar in function to their counterparts on CesiumPropertyTableProperty.
Finally, the Get Swizzle and Get Component Count Blueprints have been deprecated. If needed, use Get Channels to query the texture channel information of a property texture property. The resulting array contains the indices of the channels used to construct the property's value from the texture.
Unfortunately, there is no easy way to implement backward compatibility for the CesiumIntegerColor and FCesiumFloatColor structs, so they have been removed without replacement. Consequently, the Get Integer Color From Texture Coordinates and Get Float Color From Texture Coordinates functions have also been removed.
The metadata values may be retrieved from a property Get Metadata Values From Hit.
New model metadata API
Previously, the CesiumMetadataModel struct represented the root EXT_feature_metadata
extension on a glTF model. It has been replaced by CesiumModelMetadata, which represents the root EXT_structural_metadata
model extension.
The model metadata may be retrieved from a primitive component belonging to the model, using the Get Model Metadata Blueprint. There are also several functions to retrieve its property table and property texture contents, including:
- Get Property Tables
- Get Property Table
- Get Property Tables at Indices
- Get Property Textures
- Get Property Texture
- Get Property Textures at Indices
New primitive metadata API
In 3D Tiles 1.1, the features and metadata of a primitive are denoted by separate glTF extensions. While the new CesiumPrimitiveFeatures struct allows access to a primitive’s EXT_mesh_features
extension, the primitive’s EXT_structural_metadata
extension is represented by a different struct, CesiumPrimitiveMetadata.
The CesiumPrimitiveMetadata of a primitive component may be retrieved with the Get Primitive Metadata Blueprint. Then, Get Property Texture Indices retrieves the indices of the property textures used by the primitive. This node may be combined with Get Property Textures At Indices to retrieve the actual property textures from CesiumModelMetadata, as illustrated below:
Although metadata picking was supported by previous versions of the plugin, the expanded API in Cesium for Unreal v2.0 makes it even easier to set up picking behavior with Blueprints. It is still built around using a line trace to select a model within a 3D Tileset, but requires fewer Blueprint nodes to accomplish the same functionality.
When a line trace successfully hits a 3D Tileset, it will intersect a type of primitive component called CesiumGltfPrimitiveComponent. This component can easily be queried for any available feature ID sets and metadata, using Get Primitive Features and Get Primitive Metadata. The Get Model Metadata Blueprint may also be used on the component; it will retrieve the CesiumModelMetadata from its parent model component.
It is then possible to build behavior around the feature ID sets from CesiumPrimitiveFeatures and the metadata from CesiumPrimitiveMetadata and CesiumModelMetadata.
An even quicker way to implement metadata picking is by using the Get Property Table Values From Hit and Get Property Texture Values From Hit Blueprints. The nodes are designed to take a line trace Hit that has intersected a CesiumGltfPrimitiveComponent, then retrieve the metadata values from the specified metadata entities if they are available. The values are returned as CesiumMetadataValues mapped to the name of the property they correspond to.
The Get Property Table Values From Hit Blueprint requires a feature ID set—not a property table—to be specified by index. This value should index into the array of CesiumFeatureIdSets in the CesiumPrimitiveFeatures for the primitive. From this set, the function finds the feature ID from the intersection, aka which mesh feature was hit by the line trace. If the feature ID set is associated with a property table, then the feature ID can be used to retrieve metadata from the property table.
The Get Property Texture Values From Hit Blueprint requires a primitive property texture index, which is defined relative to the array of property texture indices in CesiumPrimitiveMetadata. In other words, you must specify the property texture based on where it appears in the array of property textures under CesiumPrimitiveMetadata. This should not be confused with the complete array of property textures in CesiumModelMetadata, which can include property textures that are not used by that particular primitive.
Previously, Cesium for Unreal allowed styling with the Cesium Encoded Metadata Component, which made EXT_feature_metadata
accessible in Unreal materials. However, in Cesium for Unreal v2.0, this has been deprecated and replaced by Cesium Features Metadata Component. The new component is functionally similar, but handles the EXT_mesh_features
and EXT_structural_metadata
extensions instead. Styling with EXT_feature_metadata
is no longer supported.