How To Create a 3D Unity Map From Lidar

Global Mapper Pro® is more than just a geospatial processing tool; it’s also a pipeline for creating 3D scenes that can be used in film, simulation, and real-world game development. In this article, we’re exploring the intersection between geospatial data and game development. With the Global Mapper Pro SDK and the Unity game engine, any developer can turn raw lidar data into an interactive 3D Unity map.

This workflow utilizes the Global Mapper Pro SDK to automate complex processes like lidar classification, feature extraction, and elevation grid generation. The result? A vivid, game-ready Unity scene complete with terrain heightmaps and tree models, all generated from real-world geographic data. But this is only the beginning; this workflow can be pushed much further, unlocking new possibilities with geospatial data and interactive design.

Automate Lidar Processing with Python

The first step is to create a Python script that leverages the Global Mapper SDK to automate the transformation of raw lidar data. The script will use functions including LidarClassifyGround, LidarClassifyGraph, LidarExtractFeatures, and GenerateElevationGrid2, which enable users to automatically load, classify, and extract terrain information from lidar point clouds.

After
Middle
Before

The script should also use vector creation functions to generate the area feature that will serve as a bounding box when we export our tile data.

Once you run the script in Global Mapper’s Script Editor, the resulting layers will appear in the Control Center. This is the perfect time to review the output and, if necessary, adjust the classification or elevation grid generation settings in the script before continuing. The quality of the elevation grid will directly influence the level of terrain detail in the final Unity map. Since the tree features are extracted based on lidar point classifications, reviewing these settings can help ensure accurate tree identification.

The extracted trees are exported to a CSV file containing each tree’s spatial attributes, such as its (X, Y) coordinates, height, and average spread.

In the script, we filtered our buildings and vegetation so that only ground-classified points remained.

Ground classified points for a DEM (digital elevation model) created with Global Mapper to create a 3D Unity Map
Only ground-classified points were used to produce the elevation grid. Other point classifications were filtered out in the script to eliminate buildings and outliers that could distort the terrain.

Export a Terrain Heightmap for Unity

Before exporting from Global Mapper, the Digitizer tool is used to select the square feature created earlier. This will crop the elevation data during the export.

The next step is to export our elevation grid in a format that Unity can interpret. This is done manually through Global Mapper’s raster export interface, using the Unity RAW Terrain/Texture format. To ensure we accurately represent the geographic information in Unity, the export will be tiled into equally sized segments (i.e., a 3×3 grid) with each tile set to a user-defined terrain size. In the export dialog, go to the Export Bounds tab and select the Crop to Selected Area(s) option to limit the subsequent output to the bounds of the square feature.

Exporting to a Unity RAW file format with Global Mapper
Figure 1.7: The terrain size parameter will depend on your version of Unity; a terrain size of 257 was used in this example.

Build Your Scene in Unity

Once exported, the terrain files and supporting data should be organized into folders to streamline the Unity import process. A simple Python script can automate this by sorting files, such as RAW terrain heightmaps, JGW world files, and other generated outputs into folders based on their file extensions. Afterward, open your Unity project and drag the folders containing the JGW files, RAW files, and the tree CSV directly into the Assets folder of your scene.
Project data CSV file for Unity

 

Begin by creating terrain tiles in Unity that match the 3×3 grid defined during the export. Open the Hierarchy panel, go to 3D ObjectTerrain, and place a single terrain in the scene. With that terrain selected, use the Inspector to access the Create Neighbor Terrains option. This tool lets you quickly generate the remaining tiles to form a full 3×3 layout.

Orient the scene so the Z axis points forward and the X axis points to the right. This setup matches the orientation of your exported data and ensures that your terrain heightmaps align correctly with each tile. GIS data typically uses a Z-up coordinate system, while Unity uses Y-up, so aligning the horizontal axes properly is essential.

Select the top-left tile (A1) and open the Terrain Settings in the Inspector. Under Texture Resolutions, set the heightmap resolution to match the value used during export (e.g., 257). Click Import Raw and choose the RAW file named for that tile. After importing, the terrain surface updates to reflect the elevation data. Repeat this process for the remaining tiles, following the naming convention where rows are labeled A to C and columns 1 to 3 (A1 at the top-left, C3 at the bottom-right). With all tiles in place, this serves as the foundation for your interactive 3D map.

Heightmap resolution in Unity for a 3D model

Tree Map Visualization with C#

Automate your visualization with a C# script in Unity that handles tree placement across the terrain grid using CSV data previously exported from Global Mapper. Attached to an Empty GameObject in the Hierarchy, the script parses the CSV containing tree positions and attributes and converts each tree’s (X, Y) coordinates into local terrain space within Unity’s worldspace for accurate placement.

This is accomplished by using the tiled JGW data imported previously, which provides georeferencing details such as pixel size and top-left coordinates for each terrain tile. Using this data, the script accurately places each tree on its corresponding terrain tile. Additionally, tree attributes like height and average spread from the CSV are used to scale and modify the instantiated tree model, adding realistic variation and size that reflect the original geospatial data.

Overlay Terrain Imagery on the Unity Map

To further enhance our scene, real-world imagery can be applied to each terrain as texture layers. To do this, the imagery must be tiled and cropped to the same bounds used in the prior steps, then exported in a JPG or PNG format. This will result in 9 images, each corresponding to a terrain tile, which you should place into your Unity project’s Assets folder

In Unity, select a terrain tile from the Hierarchy to begin applying the imagery through the Inspector window. Under the Paint Texture tab, click Edit Terrain Layers and choose Create Layer. From there, assign the appropriate image tile as a new texture layer. Once added, scroll down to the Tiling Settings section and set the Tile Size to X = 1000 and Y = 1000, or whatever size matches your terrain dimensions (1000×1000 is the default). This ensures the image spans the entire terrain tile. Repeat this process for each tile, and you’ll have a fully colorized Unity map representing your elevation data.

Global Mapper & Unity: Endless Possibilities

From here, you can expand your scene by adding gameplay systems, structures, lighting, vegetation, and custom assets. In other words, pairing these technologies opens up endless possibilities for creative expression.

More importantly, you’ve built a complete workflow that you can use to transform raw lidar data into a fully interactive 3D map within Unity. This not only bridges geospatial accuracy with creative control, but also lays the groundwork for everything that follows. Whether you’re creating simulations, game levels, or virtual worlds, this is just the beginning. The tools and techniques you’ve used here can scale far beyond this scene, unlocking new creative and technical possibilities for a range of industries.

Additional Resources

Interested in modifying this workflow? You can explore more about Python scripting with the Global Mapper SDK in the Global Mapper Python Reference and the Global Mapper SDK Knowledge Base.

For further inspiration, dive into these insightful blogs:



WORK MADE EASY WITH GLOBAL MAPPER

Want to try Global Mapper? Sign up for a 14-day free trial. You can also request a demo from one of our experts to see this workflow or other Global Mapper processing abilities.


Learn More


Companies using Blue Marble’s geospatial technology

Accuweather
Amazon
Chevron Corporation
Harvard University
Lockheed Martin
Raytheon
Boeing
BBC
National Geographic
PepsiCo