Skip to main content

Cesium Moon Terrain in Cesium for Unreal

This tutorial guides you through importing Cesium Moon Terrain into your Cesium for Unreal projects through Cesium ion.

The Copernicus Crater, visualized with Cesium Moon Terrain in Cesium for Unreal.

The Copernicus Crater, visualized with Cesium Moon Terrain in Cesium for Unreal.

You’ll learn how to:

  • Add a new Data Asset with a custom Cesium Ellipsoid.
  • Add Cesium Moon Terrain to your Unreal Engine level using Cesium ion.

Prerequisites

  • Know how to set up a basic Cesium for Unreal application. Check out our Cesium for Unreal Quickstart guide for instructions on starting with the Cesium for Unreal plugin. Use v2.7.0, published 2024-07-01, or later.
  • A Cesium ion account to stream Cesium Moon Terrain into Unreal Engine. Sign up for a free Cesium ion account if you don’t already have one.

1Add a custom ellipsoid

To properly view Cesium Moon Terrain, you will need to add a new Data Asset to store the required custom ellipsoid information for the Moon.

1From the Content Drawer, click Add and select Miscellaneous > Data Asset.

2Select the Cesium Ellipsoid from the available classes.

Select the Cesium Ellipsoid from the available classes.

3Rename the new asset to 'CesiumMoonEllipsoid'.

4Edit the details of the CesiumMoonEllipsoid by selecting the asset in the content drawer, right-clicking, and selecting Edit.

5In the editor window, expand the Ellipsoid properties.

6For the Radii, enter X = 1737400.0, Y = 1737400.0, Z = 1737400.0. Close the editing window.

For the Radii, enter X = 1737400.0, Y = 1737400.0, Z = 1737400.0. Close the editing window.

2Prepare the level

This tutorial assumes that you have already created a project and installed the Cesium for Unreal plugin. If you have not yet created a project, see the Quickstart for detailed instructions.

1Create a new level by clicking File > New Level. In the window that appears, select Empty Level to start with a blank scene.

2Open the Cesium panel by going to Window > Cesium.

Open the Cesium panel by going to Window > Cesium.

3Add a CesiumSunSky actor to the scene using the "Quick Add Basic Actors" section of the Cesium panel.

Add a CesiumSunSky actor to the scene using the "Quick Add Basic Actors" section of the Cesium panel.

This will also add a CesiumGeoreference actor to the scene.

4If this is your first time using Cesium for Unreal, the scene may appear completely white. You'll fix this in a moment. First, save your scene using the Save icon in the top bar or with Ctrl+S. Give your scene a name.

First, save your scene using the Save icon in the top bar or with Ctrl+S. Give your scene a name.

While the CesiumSunSky uses realistic light intensity values, it also includes atmosphere effects that are not needed for the Moon. You can tune the atmosphere settings:

5With the CesiumSunSky actor selected in the Outliner, select the SkyAtmosphere component.

With the CesiumSunSky actor selected in the Outliner, select the SkyAtmosphere component.

6Set the Atmosphere - Rayleigh > Rayleigh Scattering Scale to 0.0.

7Set the Atmosphere - Mie > Mie Scattering Scale to 0.0.

3Connect to Cesium ion

If you are already connected to your Cesium ion account in Cesium for Unreal, skip to Step 4. Otherwise, follow the steps below to connect your account.

1In the Cesium panel, click on the Connect to Cesium ion button.

Cesium for Unreal tutorial: In the Cesium panel, click on the Connect to Cesium ion button.

2A pop-up browser window will open. If you are not logged in, log in to your Cesium ion account. You can also sign in with your Epic Games, GitHub, or Google account.

3Once you are logged in, you'll see a prompt asking you to allow Cesium for Unreal to access your assets. Select Allow, and then return to Unreal Engine to continue.

A screenshot of the Cesium for Unreal permissions panel in Unreal Engine

4Every asset that you stream from Cesium ion, including Cesium Moon Terrain, requires an Access Token. This step shows how to set up a project-wide access token that all your assets will use.

Click on the Token button at the top of the Cesium panel.

Cesium for Unreal tutorial: Click on the Token button at the top of the Cesium panel.

5A new window will appear to configure the token. Select the Create a new token option, and rename the token if you wish. Then, press the Create New Project Default Token button.

Cesium for Unreal tutorial: A new window will appear to configure the token. Select the Create a new token option, and rename the token if you wish. Then, press the Create New Project Default Token button.

The new token you created will be added to your Cesium ion account.

If you already have a token in your Cesium ion account that you would like to use, you can select it from the "Use an existing token" dropdown instead of creating a new one.

4Add Cesium Moon Terrain from Cesium ion

Once you’re connected to Cesium ion, adding Cesium Moon Terrain to the level takes only a few steps!

1In the Cesium ion Assets panel, add "Cesium Moon Terrain" by selecting it in the list and clicking Add to Level.

2To update the georeference to be the correct size set by the custom ellipsoid created in Step 1, click on the CesiumGeoreference actor in the World Outliner. In the Details panel, look for the Ellipsoid variable under the Cesium category.

3In the dropdown, select CesiumMoonEllipsoid.

4In the World Outliner, zoom to the CesiumMoonTerrain actor to view the Cesium Moon Terrain dataset.

In the World Outliner, zoom to the CesiumMoonTerrain actor to view the Cesium Moon Terrain dataset.

5Georeference your level

Before you begin to build applications with Cesium Moon Terrain in Unreal Engine, you’ll want to learn to georeference your scene. Doing this will determine the alignment of Unreal Engine's XYZ world origin with a specific latitude, longitude, and height on the Moon.

1Click on the CesiumGeoreference actor in the World Outliner. In the Details panel, look for the Latitude, Longitude, and Height variables under the Cesium category.

Moon georeference: Click on the CesiumGeoreference actor in the World Outliner. In the Details panel, look for the Latitude, Longitude, and Height variables under the Cesium category.

2Change these variables to the coordinates of the Copernicus Crater.  The Copernicus Crater is a large impact crater 93 km in diameter and visible from Earth with binoculars.  The crater is located at 9.62 N, 20.08 W, so input these coordinates into the details of the georeference:

Latitude: 9.62
Longitude: -20.08

3Once the georeference changes, you’ll be able to view the crater and the surrounding area.

The Copernicus Crater, visualized with Cesium Moon Terrain in Cesium for Unreal.

Read more about georeferencing in Step 3 of the Adding Datasets guide.

6Navigate the world with the Dynamic Pawn

Lastly, let’s learn to navigate Cesium Moon Terrain at runtime using the Dynamic Pawn. The Dynamic Pawn is a controller included in the Cesium for Unreal Engine package that will help you navigate the Moon’s size during play mode.

1Using the Cesium panel, add a Dynamic Pawn to your scene.

Using the Cesium panel, add a Dynamic Pawn to your scene.

Make sure the dynamic pawn’s location is set to the world origin, 0,0,0 in the details panel.

Cesium for Unreal tutorial: Make sure the dynamic pawn’s location is set to the world origin, 0,0,0 in the details panel.

2You're ready to test out your scene! Press the Play button at the top toolbar.

You're ready to test out your scene! Press the Play button at the top toolbar.

You can use the W, A, S, and D keys and the mouse to fly around. You can also use the Q and E keys to move the camera vertically with respect to the Moon. Use the mouse scroll wheel if you need to change your speed.

For more information about the Dynamic Pawn and navigating your Unreal Engine levels, check out Step 7 of the Quickstart tutorial.

Next steps

See our other Cesium for Unreal tutorials to learn how to build apps on top of Cesium Moon Terrain! You may want to explore Placing Objects on the Globe or Building Global Scenes with Georeferenced Sublevels. Check out other locations using the Gazetteer of Planetary Nomenclature for the Moon.

Content and code examples at cesium.com/learn are available under the Apache 2.0 license. You can use the code examples in your commercial or non-commercial applications.