Unity Cesium loads local data (DEM, DOM)


foreword

Cesium for unity has its own data source, and it is very convenient to load data such as impact and terrain in real time under the networked state. However, many projects need to be used offline, and the official only gives the api but not example resources, which requires us to process the data and load it ourselves.
The principle of loading local data is very simple. Convert the resource to a usable format , then publish it in the form of a link, and then configure the link on the corresponding software carrier to see the effect.


1. Preparation

1. The cesium for unity project has been configured.
2. The service tool (tomcat, IIS, vue, etc.) that has been configured and published as a link (tomcat is recommended, and vue is used in this article. It is convenient to load small data for testing, but it is higher than a few The startup of 100,000 is slow/cannot start, and additional settings are required)
3. One of QGIS, ArcGIS, and CesiumLab has been installed. This article uses CesiumLab
4. Take off

二、DEM

Go to the geospatial data cloud (or other map platforms to download files in tif format) to download DEM data,
insert image description here
enter CesiumLab to slice the terrain, and select hash as the storage type
insert image description here

Enter the vue console, create and start the project (the same applies to services such as tomcat), and write down the address. Put the
insert image description here
processed data into the corresponding folder
insert image description here
and there will be a layer.json file in it. We use the address written above + layer.json access.

insert image description here
Enter the first example, find the Cesium 3D Tileset on Cesium World Terrain, change the resource method to Url, and fill in the above address.
insert image description here

3. DOM

It is the same as DEM, but when slicing, you need to prepare tif image resources, perform image slicing, and publish the resources as a service. The link address is the address where the xml is located.
The CesiumTileMapServiceRasterOverlay script needs to be added to the unity side to replace the Cesium Ion Raster Overlay.
insert image description here
If you want more url format support, you need to expand it, and then record it in a whole article.


Summarize

Simple logging of locally loaded terrain and imagery data.

Guess you like

Origin blog.csdn.net/qq_41912124/article/details/132274634