Adding Local Data

In this guide, you will learn how to load a 3D Tileset from a local directory into your project using Cesium for Unreal.

Prerequisites

  • Unreal Engine (at least 4.26 or later) and the Cesium for Unreal plugin are installed.
  • Know how to set up a level in Unreal Engine with Cesium for Unreal plugin.

New to Cesium? For help setting up a level for the first time with Cesium for Unreal, start with the Unreal Quickstart tutorial.

Set up the level

Start with the 01_CesiumWorld level in the Cesium for Unreal Samples. You can also start from scratch with a new level. If starting from a new level, populate it with at least the CesiumSunSky and FloatingPawn actors. 01_CesiumWorld level from the Cesium for Unreal Samples.

Add 3D Tileset from local directory

For this section, you will a 3D Tileset which contains some boxes of various heights. This 3D Tileset can be downloaded here. Be sure to download the entire Tileset folder, which includes the tileset.json file as well as all of the referenced .b3dm files. You can also use your own 3D Tileset instead.

If you are new to the 3D Tiles format, check out the 3D Tiles Specification to learn more.

  1. In the Cesium UI to the left of the editor, click on Add Blank. This adds a new blank Cesium 3D Tileset to the scene.

    Select the Cesium3DTileset actor in the World Outliner and rename it to “LocalTileset”.

  2. In the Details panel, look for the Cesium Category. Typically to load data from Cesium ion, you would fill out the Ion Asset ID and Ion Access Token fields. For loading local data, you will fill out the Url field instead with the path to the 3D Tileset’s main tileset.json file. Locate the 3D Tileset data in your local directory system. For example, if the directory is C:\Users\username\document\Unreal Projects\CesiumForUnrealSamples\Data\Tileset\tileset.json, then the Url would look be file:///C:/Users/username/document/Unreal Projects/CesiumForUnrealSamples/Data/Tileset/tileset.json. Note the triple forward slashes after file:.

    In World Outliner, double click on the LocalTileset actor to focus on it in the viewport. The world and the asset may be oriented incorrectly, like this:

    This is because the origin of the CesiumGeoreference actor is far from the LocalTileset actor.

  3. With the viewport still focused on the LocalTileset actor, head over to the World Outliner, select the CesiumGeoreference actor, and look for the Place Georeference Origin Here button. Click on this button to re-orient the world.

  4. Adjust the Location transform of the LocalTileset in the Details panel to place it at the desired location. For example, to position the base of the 3D Tileset on top of the terrain, change the Z coordinate of the Location transform to 7400.

Currently, loading local quantized-mesh terrain files using Cesium for Unreal is not supported. However, terrain assets can be loaded from any server, including localhost. To load terrain assets completely offline, consider setting up a localhost to serve the terrain. The Url field can be filled using the same steps as above with http://localhost:portNumber/terrainAsset.

Resources