Questions and Answers
You should upgrade to
This article aims to help with questions that arise when you use terrain generation tools.
There is a number of general tips that may be useful for overall understanding:
-
Open the Editor console (Windows -> Console). If something goes wrong, a console message might be useful in explaining the situation.
Example of console errors - If you suspect that the height data has some issues, you can enable the debug mode to check: Helpers -> Opacity World Normal.
- Don’t worry about the number of triangles in ObjectLandscapeTerrain. This object was designed so that millions of polygons wouldn’t affect the framerate that much.
- Clear cache before you start terrain generation: click the button near the cache address line in the bottom left corner of the Sandworm window.
What is the difference between ObjectTerrainGlobal and ObjectLandscapeTerrain?
Currently, UNIGINE has two objects that are used for terrain: ObjectTerrainGlobal, which has long been in use, and recently introduced ObjectLandscapeTerrain, which has many improvements.
These two terrain objects can be generated using the Sandworm Tool. There is also the Landscape Tool but it can generate only ObjectTerrainGlobal, because when it was developed, ObjectLandscapeTerrain wasn’t even in plans.
The Sandworm Tool as well as ObjectLandscapeTerrain were developed to solve the problems, which have accumulated over the years, and extend the functionality.
If you are new to georeferenced data and don’t know how to obtain source files, it might be easier to start working with Sandworm because it allows taking data directly from TMS sources.
Where can I take the geodata?
As a rule, access to private TMS servers is not free, however, there are free data sources supported by donations. If you are not in the mood of searching, you can check the list here. Keep in mind that every server has its own features and check the information in description.
Heights
For example, you can try the mapbox service. Register there in order to obtain your own token and access, for more details see this page.
Free access limits the number of requests per minute, but that doesn’t affect the overall workflow and is enough for general overview.
As soon as you register, you’ll receive a token which is a string of various symbols. Add this token to the following URL after the equality sign (=): https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=YOUR_ACCESS_TOKEN, and use this URL in Sandworm to obtain the data for the corresponding level.
Imagery
Here are examples of imagery TMS servers you can use for general overview:
- https://khms2.google.com/kh/v=871?x={x}&y={y}&z={z} — Google Maps data
- http://a.tile.openstreetmap.org/{z}/{x}/{y}.png — OSM topographic data with a legend
Vector
As a free source of vector data that can be used for a basic overview, you can check https://www.openstreetmap.org and use https://extract.bbbike.org/ as an aggregator for it.
The mentioned links and sources are provided as a quick start for an overview. You can use them and the Sandworm documentation if you don’t have any georeferenced data at hand. Exporting data from third-party tools is a huge topic for research in itself, and would take much more time than getting along with our tool.
Which projection should I select to have the minimum surface distortion?
Unfortunately an all-fitting universal projection doesn’t exist, because every projection is a flat representation of a curved area, and the farther a point is from the center (origin) of the projection, the higher the data corruption is. You can find more on Wikipedia or search for other explanations on projections. The output projection should be chosen based on source data at hand or the project requirements.
You can use https://epsg.org/ to find the best-fitting projection with minimum inaccuracy for the selected area.
How to use https://epsg.org/:
Go to EPSG Dataset -> Map Search, set the area boundaries and click Search. You’ll receive a table, sort it by type (click on the TYPE heading) and select one of the data sources that is marked as Projected.
Again, for a start, you can use EPSG:3857 — this is a projection widely used by such services as Google, OpenStreetMap, Navitel, etc.
The more detailed the tiles are, the more time is required to load them. The Generating Preview pop-up will give you a hint — it is displayed in the bottom right corner of Sandworm while the data is downloaded. In addition, in the Editor console there’ll be a message looking like "ImportCacheTile 465.162000 ms" when a tile is loaded.
We recommend attempting with low Zoom values first. This will give you an overall understanding about the data you add, then you can increase the Zoom value and click Reimport. The higher the Zoom value is, the more detailed is the data (and the more time it takes to download from a server). If the data is too heavy, you’ll see a notification.
Sometimes neighboring tiles are of different colors. Is there any workaround for that?
This can happen when you take data from TMS servers. Better data usually costs money.
You can try to change Zoom for a certain area. One more solution is to make insets using other TMS sources: for example, you generate the whole area with Zoom = 10, and for the problem area — create another layer, use another source for it, and set Zoom = 14 (the given zoom values are just an example, try your own values).
The result of generation is wrong. / Only a part of the area has been generated.
Check that the output projection is set correctly.
If the data is outside the selected output projection, it won’t be used for the terrain generation — only the part that is inside will be generated. The corresponding message will be also shown in the Editor console.
A quick check: re-generate the project without defining the Export Area (select the Export Area option and click the Press to Clear button in the Parameters tab). Sandworm will generate only the areas for which the data is available.
Preview generation is also helpful in defining if you have data for the area that is missing. If you canceled the preview generation, restart it by right-clicking on a layer and selecting Generate Preview.
Only a part of the generated terrain is visible in the viewport.
Change the camera visibility distance: in the Editor window, click the gear icon for the selected camera and increase the Far value. You can set the maximum, which is 900000.
Adjust the visibility distance for ObjectLandscapeTerrain. It is set in the Editor settings: Windows -> Settings -> Landscape -> Visibility Distance. You can set it to inf.
When I click Run, I see the black screen after the world is loaded, although there are cameras in the scene.
The scene contains a camera by default, which has the Main Player parameter enabled. This parameter defines the image from which camera is displayed when the world is run. Enable this parameter for the camera that you want to control at runtime, for example Sandworm camera — it is spawned right above the terrain, and disable all other cameras.
How to position an object using its geo coordinates?
For ObjectTerrainGlobal, you can use Geodetic Pivot in the Editor — every object added as its child can be positioned on the terrain using geographical coordinates set in latitude/longitude.
As for ObjectLandscapeTerrain, the positioning tool is still in development, meanwhile you can transform coordinates using third-party sources, such as https://products.aspose.app/gis/transformation.
Here is a description of the workflow:
-
Transform the object and the origin coordinates to the world coordinates (mind the input and output projections).
Source coordinates of the object (screen capture from Google Maps)Source coordinates of the origin (Export Area parameter in Sandworm)Transforming coordinates using aspose.app -
Take the origin position from the object position: Object.X — Origin.X; Object.Y — Origin.Y.
Calculating the world coordinates -
Use the outcome as the X and Y coordinates of the object in the world.
Object positioned in the world
Developers can also use Geodetics Plugin and position objects via code.
IG Plugin has the worldToGeodetic() method and GeodeticsTransformer class to position objects.
Terrain is not generated. / Editor suddenly closes.
Generating a terrain is a very resource-consuming operation. For vast and detailed landscapes, you might need a lot of RAM available.
We recommend having 64 Gb RAM (at least 32 Gb).
Disabling the Microprofile tool can also save up to 6 Gb RAM. This may be done either by running the Editor with the external argument "-microprofile_enabled 0", or disabling it in the Editor console.
If you have crashes while generating a terrain, gradual adding layers one by one and generating can help finding a problem with the data. Or at least remove the vector data layer, because it may be very consuming.