1 • Cesium in Unity
Cesium is a platform for creating 3D maps and geospatial applications. It provides a suite of tools for creating photorealistic 3D maps and terrain, and for visualizing and analyzing geospatial data. Cesium for Unity is a plugin that allows you to use Cesium's 3D maps and terrain in Unity.
The Cesium ion part is what hosts global terrain, imagery, and building data, and is where you can upload your own datasets. It is a cloud-based platform that provides a variety of services for working with geospatial data, such as tiling, styling, and hosting 3D content.
This data can be accessed in Unity through the Cesium for Unity plugin, which provides a set of tools for working with Cesium's 3D maps and terrain in Unity. This allows you to create interactive 3D maps and geospatial applications in Unity, and to combine Cesium's geospatial data with Unity's game development capabilities.
New Unity Project
Let's create a new project in the Unity Hub to illustrate how to set up Cesium for Unity. You can also replicate the steps in your own project if you already have one, but make sure that you are using the Universal Render Pipeline in it.
Head over to tutorial page for Cesuim for Unity Cesium for Unity Quickstart and follow the instructions from Step 1 until Step 4. This will guide you through creating a new Unity project and importing the Cesium for Unity package, while adjusting Unity to work better with Cesium.
Photorealistic 3D World
Instead of using "Cesium World Terrain + Bing Maps Aerial imagery" in Step 3 of the tutorial, choose "Google Photorealistic 3D Tiles" to have a more detailed and realistic terrain, which includes trees and buildings!
Here's a recap of the steps. You should have added a scoped registry to your project.
Using the Package Manager, you should have installed the Cesium for Unity package.
Now you should have a new menu item in Unity called Cesium, which allows you to connect to your Cesium ion account.
New Location
If you continued with the steps of logging in and adding the Cesium ion asset to your scene, you should have a nice 3D map in your scene view. You can change its settings by selecting the CesiumGeoreferece object in the scene hierarchy. For instance, let's go to Paris by entering the coordinates 48.8584
in the Latitude and 2.2945
in the Longitude fields, and setting the Height to 500
.
Simplest Interaction
You now already have a full 3D map in your scene, in principle ready to be used for a flying or platforming game. In the Google Photorealistic 3D Tiles object you can select the Create Physics Meshes toggle (on by default) to have colliders for the terrain and buildings. Try to create a basic object and have it bounce around the Eiffel Tower!
With collisions and physics you can simulate not only silly bouncing, but also light and shadow, fluids, and many other things.
More in Cesium
You can continue to explore the next two tutorials on the Cesium page on how to properly place objects on the globe, and how to build georeferenced sub-scenes if your ideas require these things. You could for instance place objects that spawn agents or that a player can interact with.
You can even go to space and explore the moon — just add the Cesium Moon Terrain asset to your Cesium ion account and you will be able to add that to your scene instead of the earth and launch a lunar reconnaissance mission!
The instructions for that exist only for the Unreal engine so far, so it is your challenge to translate them to Unity as an exercise.
Limitations
As nice as Cesium is for Terrain and global exploration, we are limited to terrains and colliders. We can not directly access e.g., data about buildings or roads and do something with that. For that, we have to turn to Mapbox.