3D printing of digital elevation models

The educational technology and digital learning wiki
Jump to navigation Jump to search

Printing elevation models

Isola di Vulcano - PLA, 25x20cm, green PLA, printed in about 16h

Physical terrain models can be made with various technologies. 3D printing is a good choice for smaller models. For larger models we suggest stacking plates cut with a laser cutter or another tool. Milling is another option, but noisier and more dusty than 3D printing. Printed elevation models are useful in teaching, outreach activities, informal learning settings like museums, tourist offices, urban planning, etc.

This article describes how to create printable STL models with (mostly) free tools from various kinds of free terrain data (digital elevation models, DEM). Producing STL models from terrain data can be similar to producing models from 3D scans since some digital elevation models (DEMs) also use point clouds. This text is under construction and may need re-organizing. For the moment, I just take down notes of what I am playing with. So far, I identified several ways to create digital elevation models that work.

  • The easiest solutions are Using Touch Terrain and Terrain2STL. Touch Terrain (see below), as of Mai 2021, is the best existing online service and it is totally free.
  • An other powerful and versatile tool combination is using QGIS and the Demto3D plugin. Read 3D printing of digital elevation models with QGIS
Lake Geneva - Mont Blanc area - White PLA, 19x16.5cm, printed in 11h26m

See also:

Typical workflow

The outline of the workflow is the following (some tools allow combining steps, in some situations steps are done in different order or differently)

  1. Get a model. This usually requires some extraction work, e.g. download a file, extract a square from given coordinate position
  2. Transform the model to a 3D model (digital elevation models usually are not 3D models)
  3. Make the model manifolded with a flat bottom.
  4. Scale, rotate and re-position (if necessary)
  5. Translate this model to STL.
  6. Repair the model with an STL editor, e.g. use Netfabb (repair tool) or Meshmixer ("make solid")
  7. If the model represents a very small area you can slice it "as is". If it is larger, consider reducing the triangles (if not done before), e.g. using the free Meshlab program to do that (see below)
  8. Crop x,y direction if there is a need. Add a box to the bottom if there is a need.
  9. Adjust the Z-axis (if not done before). In some cases you might want to emphasize horizontal distances by a factor of 2, 3 or 4.
  10. Slice and print it. This is not as easy as it seems and for two reasons. Models can be huge and slicer settings must be adapted to avoid print aborts (in particular nozzle getting stuck in plastic).

Too much for you ?

3D printing too slow ?

Digital elevation model formats

A digital elevation model (DEM) is a digital representation of a terrain surface that is created from elevation data. There are two kinds:

  • Digital terrain models (DTM) include just the terrain
  • Digital surface models (DSM) include things on top, like buildings).

It is not clear (to us) whether radar models that measure the tips of trees and houses are DTMs or DSMs.

There are many formats used. Difference in horizontal resolution can be important. E.g. SwissALTI3D is only 2m meters, Eu-DEM is 25 meters, free SRTM data is between 30 and 90 meters. A resolution of 90 meters is fine enough for a larger area, e.g. 100x100km. Printing nicely smaller mountains requires 30 meter resolution. There exist errors for height (usually expressed in terms of mean errors).

Wikipedia has a good GIS file formats list that includes formats that can include DEM data. Acording to Wikipedia's Digital elevation model article, DEM can be represented as a raster (a grid of squares, also known as a heightmap when representing elevation) or as a vector-based triangular irregular network (TIN).

  • According to Wikipedia (March 2017), Raster data consists of rows and columns of cells, with each cell storing a single value. Raster data can be raster images with each pixel (or cell) containing a color value. Additional values recorded for each cell may be a discrete value, such as land use, a continuous value, such as temperature, or a null value if no data is available. While a raster cell stores a single value, it can be extended by using raster bands to represent RGB (red, green, blue) colors, colormaps (a mapping between a thematic code and RGB value), or an extended attribute table with one row for each unique cell value.
  • Again, according to Wikipedia's GIS file formats article, there are three types of vector graphic elements: points (to represent precise location spots), lines (to represent roads, rivers, etc.) and polygons. Elevation can be represented either by contour lines or by polygone meshes, usually triangulated irregular networks (TINs)s. “A TIN is a vector-based representation of the physical land surface or sea bottom, made up of irregularly distributed nodes and lines with three-dimensional coordinates (x, y, and z) that are arranged in a network of nonoverlapping triangles.”.

Below we just the list most of the the data types we played with and that appear in this article

Name File extension Description Data type
ESRI ASCII GRID asc A popular GIS specific exchange format. See Esri grid (wikipedia) raster
geoTIFF tif or tiff Annotations to the 2D TIFF format. See GeoTIFF (Wikipedia) raster (grid)
DXF dxf Autocad proprietary but many tools can import/export vector
XYZ xyz Initially designed to describe molecule geometry. vector (point clouds, each point has a x/y/z coordinate and there are no links between points)
SRTM HGT hgt SRTM original format raster
DEM dem geospatial file format developed by the United States Geological Survey raster
Collada dae 3D models used withing Keyhole Markup Language (KML), Google Earth vector
GeoJSON json Popular exchange format for open source GIS packages vector

Digital elevation model (DEM) repositories

Most DEM data that is freely available on a world-wide basis has been collected by the NASA Shuttle Radar Topography Mission (SRTM) in 2000. It took 11 days to map out the Earth (except the seas and polar regions). Resolution of SRTM data is the following:

  • 30 arc seconds (DTED level 0) - about 900 m spacing
  • 3 arc seconds (DTED level 1) - about 90 meters spacing
  • 1 arc second (DTED level 2) - about 30 meters spacing

There are many other DEM data sets (primary or secondary) world-wide or on a national or local basis. Several of these data sets make use of the SRTM data set. A good list of available SRTM data sets is in the OpenStreetMap Wiki SRTM article.

Below are a few DEM repositories. Most of these require some "thinking" before you actually can get at the data.

Name Resolution (x/y axis) Mean errors (z)

depend on slope

Data Source
CGIAR-CSI SRTM 90m Allows finding and exporting squares with 90 resolution for the whole earth.
USGS EROS (US Geological survey) - EarthExplorer 30 to 90m Various, e.g. SRTM The Earthexplorer allows finding map squares according to area and criteris, e.g. I found 30m resolution SRTM data for Geneva ara. Since the tiles cover small areas you may have to combine these.
ViewFinderPanoramas (VFP) 30.92m SRTM and ASTER GDEM
EU-DEM 30.92m
EOWeb Poral (DE)
DHM25 25m 2-8m Swisstopo Prior to SwissALTI3D, based in essence on the 1:25000 maps. This data set is free
SwissALTI3D 2m Swisstopo commercial dataset

Using TouchTerrain

The TouchTerrain software [1], developed by Chris Harding and Franek Hasiuk (Iowa State University), is a very easy to use online service, also available as offline program, to create printable 3D STL models. It grabs DEM data from Earth Engine and turns them into STLs. It has a bunch of settings (simple and “expert”). It also allows printing multiple 3D models that can be glued together into a bigger model.

More information and official manual:

Online version

Use:

  • Select a DEM map service (elevation data source), e.g. AW3D30
  • Select an area in the world map, the click on Re-center box in current map view
  • Specify printer options, e.g. tile width, extruder width of your printer, model base thickness (from the lowest point, not sea level), vertical exaggeration.
  • Save options to URL (so that you can bookmark a solution), e.g Geneva basin
  • Click Export
Screenshot for Touch Terrain 2.5
Exported STL model from Geneva basin area

The online version has seen a major update in Spring 2021 and includes a new GUI, place search with fly-to (very popular!), hover over (or click-toggle) help bubbles (the ?s), xml/kmz file import: digitize a polygon in google map (or whatever), save it as KML file and use it to outline the print area, “auto” z-scaling: set z-scale value to a height (say 20 mm tall) and the software will figure out a z-scale that makes your print 20 mm tall (excluding base height). Not yet tested- Daniel K. Schneider (talk) 10:27, 11 May 2021 (CEST)

Desktop software

As of May 2021, there is a docker image for running TouchTerrain standalone jupyter notebooks via a container. It needs a bit of setup and a somewhat beefy PC (or Mac or Linux box) but will install everything for you. If you haven’t tried the standalone (desktop) version, the author recommends using this dockerized version and the starter jupyter notebook.

Using Terrain2STL oneline service to produce STL from 90m SRTM dataset

Terrain2STL was in the past the the easiest and fastest way to get going and is alternative to Touch Terrain. Any beginner with a moderate amount of 3D mesh manipulation skills can do it.

Terrain2STL is an online service that allows selecting a square on Google maps. From these coordinates it then will extract a region from the Nasa/cgiar-csi data and produce the STL. Quote: “Terrain2STL is a free-to-use service, but if you want to help support the site, donations are welcome. Terrain2STL creates STL files using the SRTM3 dataset from 2000, which has a resolution of about 90 meters on the equator.” (Terrain2STL home page, feb 2017)

It only will need some cropping and a little STL repair, e.g. something that Netfabb Studio or other STL repair/slicer software can handle very well.

I tested this service and it works really well, e.g. I printed the Teide and Caldera Blanca volcanoes. The only caveat is the 90m resolution of the SRTM3 data set. The Caldera Blanca is a small 300m mountain on Lanzarote and did not come out in a very interesting way. The Teide (including its old huge caldera) created a fine enough model.

In case you want some more control, you can use the QGIS solution. If you own a Linux system, you also can use the hill program below which provides the same kind of results. While figuring out the coordinates and dimensions of your map takes more time, producing it is faster.

Finally, you should be aware that printing 3D models may require different slicer settings than the one you typically use. See below.

Produce STL from ASC SRTM data with the hills command line tool

Hills is a command line package that can generate 3D models of areas in STL format of the earth's surface using SRTM 90m elevation data from CGIAR-CSI (see http://srtm.csi.cgiar.org/).

This command line tool is programmed in Haskel and requires some installation work. If you are not afraid of typing instructions, it's an easy to use tool. It can directly extract the right squares before doing the STL translation.

Installation under Ubuntu

To install Haskel and cabal

sudo apt install cabal-install

To install hills:

cabal update
cabal install hills

I found the program in ~/.cabal/bin/ so you might add this to your path:

  • Edit ~/.bashrc
  • Prepend /home/your_login/.cabal/bin to :$PATH, e.g.
export PATH=/home/_____/.cabal/bin:$PATH

Using hills to create printable STL terrain models

This method works with the dataset and tools described below. I did manage to create fairly quickly a decent STL model of the Geneva basin area - Daniel K. Schneider (talk) 16:41, 3 March 2017 (CET)

Get a data file from CGIAR-CSI. The earth is divided into squares. Make sure to take the ESRI ASCII (*.ASC version !).

SRTM Data Search allows to identify squares that you then can dowload
  • Either use the website where you can select the squares (see figure above)
  • Or write down the square number and change the URL below. 38_03 represents parts of Western Switzerland, French Haute-Savoie etc. (are where University of Geneva is located)
wget http://srtm.csi.cgiar.org/SRT-ZIP/SRTM_v41/SRTM_Data_ArcASCII/srtm_38_03.zip
unzip srtm_36_01.zip

You now should have the following 150 GB file

150147952 Nov 24  2008 srtm_38_03.asc

From there you can extract rectangles that will be translated to STL models. You need the following information:

Get center coordinates

  • Coordinates of the center, defined as decimal latitudes and longitudes. North of the equator is positive, south is negative. East from Greenwich is positive, west is negative. A good trick is to ask Google. E.g. longitude Geneva gives:
46.2044° N, 6.1432° E

Exactly what we need to extract terrain around Geneva. If you cannot retrieve this directly from google search, you could use google maps or google earth and then click on a point. E.g. my office building is around:

46.194644, 6.140955

Define rectangle size

  • Hills requires an area in arc seconds, latitude first. Default values are 300x600. An arc second is 1/3600 of a degree and roughly represents 30 meters (it depends where you are). Therefore:
1km = 33
10km = 330

Since any decent STL tool allows you to cut away slices, you do not need to be very precise. Better take 50% extra terrain.

Define elevation

  • By default, the model will start a sea level. Again, you easily could not define any elevation and just cut off a slice in the z-direction. But you may consider giving a height. Again, you simply can ask google, e.g. elevation geneva. Add enough height to cover the lowest point of your area.

Define scale

  • By default, an area of 30x30km will come out much too big. You can change the size later, but by using the scale parameter you can make it smaller.
500 will reduce it by 1:500

Example using the three parameters described just above. By default, hills will look at all the *.asc files that sit in the same directory.

hills --position 46.194,6.140 --dimensions 600x600 --base-altitude 300 --scale 1000 geneva.stl

generating for

 46-6-36N 6-3-24E to 46-16-39N 6-13-24E
 603 arcsec N/S x 600 arcsec E/W
 18.618km N/S x 12.865km E/W

Here is the result as seen in Meshlab:

Geneva terrain model made with hills and SRTM data

A second, better attempt that covered the whole was:

 hills --position 46.194,6.140 --dimensions 1200x2400 --base-altitude 200 --scale 250 geneva-large.stl
Geneva terrain model being cropped in Netfabb

The following will create a (roughly) 99 x 114 km area of the Geneva Lake - Mont Blanc area. Initially I extracted at base-altitude of 150m, but that was not low enough for such a large area.

hills --position 46.138,6.459 --dimensions 3200x5300 --base-altitude 0 --scale 600 geneve-mont-blanc.stl
generating for 
 45-41-36N 5-43-21E to 46-34-57N 7-11-42E
 3201 arcsec N/S x 5301 arcsec E/W
 98.834km N/S x 113.781km E/W

For faster slicing and easier manipulation, you should reduce triangles, e.g. with Meshlab (see below)

Slicing of the Geneva Lake Mont-Blanc Area (6 minutes)

Converting DEM files with AccuTrans

AccuTrans is a cheap commercial DEM file manipulation program. It can important various DEM formats in various ways, create a 3D model and add a bottom and, finally, export to STL.

  • Download the software from http://www.micromouse.ca/. It is free for one month. After that you should pay CAN 20$, which is very cheap for what you get. In particular, the possibility to add a box to the bottom of non 3D DEM model makes this tool a must have.
  • Hit F3 to select another layout (e.g. large window)

Initally, I tested the free 25m/200m resolution files from SwissTopo, i.e. fairly huge files. The dxf is 358 MB.

358870706 Jul 1 2010 DHM200_polyface.dxf
41714539 Mar 26 2010 DHM200.xyz
18153345 Mar 15 2010 DHM200.asc
  • It did read the ASC file and convert it to STL. However it is fairly low resolution (1926x1201 cols for Switzerland. Plenty enough for printing the whole thing, but not smaller parts). the exported STL was 14MB.
  • It did only load parts of the dxf (complained about a line that is long for a buffer)
  • It did manage to load the xyz file (41MB). Displaying it was straining the CPU and/or GPU). The exported STL was 146MB and (10 times bigger than the one produced from the *.asc) left-right inverted.

Extracting areas from these monster models can be challenging for some computers. You also could use one of few "educational models". E.g.Swiss topo provides two sample data (one is the model available as thing 26746.

I also use AccuTrans to process Collada (*.dae) files extracted from OpenStreetMap with Maperitive

Dealing with Autodesk dxf files

The steps for converting dxf files are described in Relief für den 3D-Druck aus DHM oder DEM erstellen are the following:

(1) Load the model

  • File -> Open (New) or Open (All Formats)
  • ... wait

(2) Make it a 3D model

  • Tools->Extrude Pseudo 2D surface

(2) Scale (this is optional)

  • Tools_1 -> Adjust object parameters
    • Click on Calculate scale. Select the larger x or y value, then enter a desired result, e.g. 200 because your printer will want millimeters and your print bed is not much bigger than that. You always can fine tune in the STL editor.
    • Hit the scale button
    • Tick Set Min at 0.0.0
    • Click OK at the bottom.

(3) Add a bottom

  • Tools->Extrude Pseudo 2D surface
    • Tick "Flat Bottom"
    • Add thickness, e.g. 50000 for the Swiss top map, 1000 for a model that varies from Z=192 and 4556 (Mont Blanc), or 0,5 for a small model
    • Click on Extrude
    • ... wait if your file is large

(4) Rotate the model (optional)

  • Rotation can be wrong (y axis should point down, i.e. Blender style)
    • Click on Adjust Object icon
    • Rotate 90 degs on the X axis. You now should see the model from the top. Click on the 90 button in the Rotate panel

(5) Export as STL.

  • Save as, select STL
  • The orginal *.dxf from Swiss Top was about 359 MB. The STL was 467 MB and included 4'643'020 vertices (points) and 9'345'628 faces. Now that is large file but Meshlab could handle in on my old Ubuntu machine with a low end Quadro card. Same for my older Dell XPS 17 with an old Nvidia mobile card.

(6) Decimate triangles if your file is big

  • Your printer cannot print 10 million faces. So, either select an area for printing and crop the STL or reduce the triangles (see below for triangle reduction in Meshlab).
  • After reducing it down to 5% the file became more manageable.

(6b, alternative)

  • Load the STL file in an STL editor that allows slicing, e.g. Netfabb
  • Cut out your area.
  • My very old Precision workstation I use for controlling the 3D printer was able to handle the 500MB file, but just barely...

(7) Repair and scale the file in an STL editor

  • Repair is needed, the file does have bad mesh problems,
  • Scale to right x,y size
  • Augment (optionally) Z, e.g. to 200%
  • Repair again, save,

The resulting file had about 440K triangles which is maybe reasonable. ... slice and print

Dealing with ArcInfo ASCII grid (*.asc) files

(1) Open the file

  • Important do not just load the file, but click on "open", select ArcInfo ASCII Grid, then select the file. Since *.asc also can refer to another format you will have to do it this way !
  • Click on OK

(2) Make it a 3D model (maybe there is another way)

  • Menu Dem->Create 3D model
  • Menu Tools_1 -> Extract pseudo 2D surface
    • In the dialog, tick Flat Bottom and add a thickness, e.g. 1000 for a model of Switzerland (look at Z min and Z max). In the Swiss case this will add 1000 meters underneath, i.e. a fifth of the highest peak (in Italy), i.e. about 2mm in the printed model (dependent on how it will be scaled)
AccuTrans3D - *.asc model seen from the bottom - it's not printable like that
AccuTrans3D - After transforming an *.asc model to a 3D model with a flat bottom added

(3) Save as STL

  • Save as STL
  • Use an STL editor to clean the mesh and to clip if necessary.

Using XYZ files

(1) Open the XYZ file

  • Select "Probe Scan" (for the Swiss Top files)
  • Scale Z coordinates if you like
  • Tick OK

... wait

(2) Convert to 2D structure

  • See above

... to be continued.

Using *.dae files

Collada (*.dae) is used by Google earth and is used by Sketchup as exchange format.

Read OpenStreetMap, the chapter on Maperitive, 3D printing section.

The procedure is the same as for *.dxf files (+/- some little details).

Creating STL from OpenStreetMap data

This is described in Maperitive for laser cutting and 3D printing. The procure described takes more time and uses the same data, i.e. at some point in the prodecure you will retrieve the same type of STRM data and then pass the model to AccuTrans (see previous section).

Using OpenStreeMap is only a good option, if plan to "annotate" the 3D model with other information. E.g. print lakes, streets or boundaries with a another color (double print head required). You also can imagine to alter the geometry, e.g. extrude walls.

Using QGIS and the GDAL library

QGIS is a free GIS tool and its DEMto3D plugin allows to produce printable STL files. GDAL is a raster manipulation library that you could use standalone via command line instructions or through the "Raster" menu in QGIS.

We found this toolset to be both flexible and relatively easy to use. Recommended if you plan do create elevation models from a variety of data formats.

Creating STL from geoTIFF elevation maps with gdal and phstl.py

I do not know how well this works, since I focused on other solutions. See the QGIS/DEM23D plugin and the "hills" program above as alternative.

Installation under Ubuntu 16x

Requirements: The GDAL library and its Python bindings. Test if something is there:

ogrinfo

If not, see above (installation of GDAL)

Download the phstl.py script

git clone https://github.com/anoved/phstl.git

Copy the script to some place that is in the PATH,e .g. ~/bin or /usr/local/bin

Transforming a geoTIFF to STL

Get an example file, e.g. from CGIAR-CSI[2] that provide elevation models for the whole world.

You can select a square in an area of interest. However this will create huge files. Most of Sicily sits in a square that is represented by a 72 GB tiff file. Translated this produced a 565 GB (!) STL File, which will be very difficult to handle.

Transform the tif into a non printable STL with phstl.py

Example:

phstl.py srtm_39_05.tif sicily.stl

Since the STL was too huge I did not pursue this.

Creating STL from XZY point clouds with Meshlab

(not done yet since I somewhat failed, and then discovered the easy to use AccTrans program, see above)

Some interesting data is available in the form of point clouds, i.e. points defined by their x,y,z coordinates. E.g. 3D scanners produce this kind of output.

I tried creating a model from the free DHM25 Swiss topology office. The download link is at the bottom a provides a zip file that includes a huge dxf files, and two much smaller *.asc and *.xyz files.

Here is the procedure:

  • Import the xyz file

(1) Sample points

Filters -> Sampling -> Poisson-disk Sampling
  • Tick Base Mesh Subsampling
  • Try to go as high as you can, e.g. I just added the number of all vertices.
  • The layer with the transformed data should be active
View -> Open Layer dialog; If needed, highlight poisson-disk samples

(2) Compute normals for the point set. Menu:

Filters-> Point Set -> Compute Normals for point set
  • Tick "Flip normals w.r.t. viewpoints"
  • Change number of neighbors from 10 to 20 or 30
  • Tick "flip normals w.r.t. viewpoint" ??
  • Apply (and wait for a long time if you forgot to sample or if you have a high sample)

(3) Then build the surface

Filters -> Point Set -> Surface Reconstruction : Poisson
  • Set Octree depth = 10

The result of the poisson disk sample looked ok (I could recognize a nice 3D model showing off the Alps, but the final result looked like a bunch of dragons cut into pieces ... The last step somehow went wrong.

Mesh reduction

Typical SRTM data sets include a rather high resolution, i.e. a 90 meters grid and models of a smaller area do have a manageable size. But if you plan to print 100 x 100km areas with mountains, I suggest reducing the amount of triangles a bit, unless you got really good hardware.

Mesh reduction with Meshlab

A good open source mesh manipulation tool is Meshlab, download and install it you don't already own it. If you already got an STL file, you also can use an STL editor, or Autodesk Meshmixer. The later can clean the inside of an object which sometimes is very handy.

Good mesh reduction is a fairly complex process since the algorithm should also preserve the shape. Be prepared to wait for many minutes or even hours if you got a slow machine. Therefore write down paramaters that work for you (wanted result, DEM file size, terrain structure, etc.)

Mesh reduction with the Quadric Edge Filter (0.25 is a minimum)

Triangle reduction with Meshlab

Step 1

Menu File -> Import Mesh

Step 2

  • Tick the Wireframe Icon on top

Step 3: Select the (maybe) best triangle reduction filter

Menu Filters -> Remeshing, simplification, and Reconstruction
Quadric Edge Collapse Decimation

Now in the small popup

  • Tick "preserve Normal", maybe also "preserve topology"
  • Enter target number of faces or enter a fraction, e.g. 0.25 as a minimum
  • Apply

Then wait for a while. Verify the result. Sometimes a reduction can alter the overall geometry. The 25% reduced version of the Lake Geneva - Mont Blanc region still took a long time to slice.

MB vertices (points) faces (triangles)
Before 234MB 2'343'502 4'680'670
Reduction to 20% 46.8MB 468'115 936'133
Reduction to 10% 23.4MB 234'195 468'299

I took 20 or 25% versions to slice. Of course one doesn't need that many triangles, but reducing too much may take out some mission critical features, like canyons or mountain tops close to each other. But I don't have any precise idea on that.

After that make sure to pass the mesh through a repair tool. Ideally you should that three times. Before reducing, after reducing and after adjusting the Z-height (I usually multiply by 2).

You also could Meshlab to repair the triangle structure (mesh), but I prefer using Netfabb since it does not require any understanding :)

Mesh reduction from the command line

Meshlab can be use in command line mode through the meshlabserver program. It comes installed with Meshlab.

Usage:

   meshlabserver arg1 arg2 ...  

where args can be:

-i [filename...]  mesh(s) that has to be loaded
-o [filename...]  mesh(s) where to write the result(s)
-s filename       script to be applied
-d filename       dump on a text file a list of all the filtering fucntion
-l filename       the log of the filters is ouput on a file
-om options       data to save in the output files

In other contexts, it is important to define what features should be saved. None of these are available for STL. It only includes triangles.

List of om options
vc -> vertex colors
vf -> vertex flags
vq -> vertex quality
vn-> vertex normals
vt -> vertex texture coords
fc -> face colors
ff -> face flags
fq -> face quality
fn-> face normals
wc -> wedge colors
wn-> wedge normals
wt -> wedge texture coords

Generic example:

// cleanup with a script and save the same file format
meshlabserver -i input.obj -o output.ply -s meshclean.mlx -om vc fq wn
// simple file conversion
meshlabserver -i input.obj -o output.stl

Mesh reduction and repair script example (the quadratic edge collabse is not ready yet)

meshlabserver -i input.stl -o output.stl -s clustering-decimation-script.mlx

E.g. the following would reduce a large STL terrain file with over 5'000'000 triangles. File clustering-decimation-script.mlx:

<!DOCTYPE FilterScript>
<FilterScript>
 <filter name="Clustering decimation">
  <Param type="RichAbsPerc" value="0.9649" min="0" name="Threshold" max="321.617"/>
  <Param type="RichBool" value="false" name="Selected"/>
 </filter>
 <filter name="Remove Duplicate Faces"/>
 <filter name="Remove Duplicated Vertex"/>
 <filter name="Merge Close Vertices">
  <Param type="RichAbsPerc" value="0.032162" min="0" name="Threshold" max="3.21617"/>
 </filter>
 <filter name="Remove Faces from Non Manifold Edges"/>
 <filter name="Close Holes">
  <Param type="RichInt" value="30" name="MaxHoleSize"/>
  <Param type="RichBool" value="false" name="Selected"/>
  <Param type="RichBool" value="true" name="NewFaceSelected"/>
  <Param type="RichBool" value="true" name="SelfIntersection"/>
 </filter>
</FilterScript>

Mesh reduction with 3D Builder

3D Builder is a free mesh manipulation program from Microsoft that needs to be installed in windows 10

  • Click on Modify -> Simplify
  • Set a reduction percentage with the slider (left is little, right is a lot)
  • Apply and save the file as

Mesh reduction can create bad meshes. Use the repair tool to fix that (or fix with another program). When I tested this program with a larger model from the Eiger area in Switzerland, I fixed the model, but according to Netfab Pro it still had mistakes and I used the latter to repair the model.

The same tool also can smooth. This can be useful if you plan to print steep mountains that won't hurt. However, use very little !

Mesh reduction with Meshmixer

The meshmixer tool from Autodesk is somewhat easier to use, once you understand how to find the tool. It is not in the menu, since users are rather encouraged to reduce selected spots during mesh editing.

Using the mesh reduction tool

To reduce a whole terrain model, you must use shortcut keys (unless I did not understand something)

  • Click on the object (not sure that this is necessary)
  • CTRL-A (to select all). Wait until the object is orange! This can take minutes. Do not click on anything.
  • SHIFT-R (to launch the reduce tool). Wait (!!). You won't see any immediate feedback for this key stroke ! In addition, you may have to wait minutes before the reduce tool pops up. Ignore the popup to left that sits there by default.
  • Enter the percentage of reductionvalue in the box, e.g. "90". Again: Do not specify the target percentage. E.g. if you want a file that is 10% input 90. Do not use the slider and do not touch anything else. In principle you should be able to move a percentage slider. However, as soon as it is touched, the program starts computing and does not allow any sliding anymore....
  • Click on Accept. This will compute the reduction for real and you will have to wait some time (minutes or hours depending on your model and machine)
  • File -> Export. You finally can export to binary *.STL format. Saving as Autodesk *.mix is a better idea if you plan to do other operations on the same output, e.g. add holes.

Examples:

  • 5% reduction of a 757MB, >4Mio triangle ascii STL model of Gran Canaria led to a 200MB binary STL model.
  • 95% reduction gave 215'000 triangles and a probably good result. File size is 10MB which is good.
  • 99% reduction of the same model gave 43'000 triangles and a bad result, i.e some features disappeared
  • 90% reduction of a 787MB Vercors ascii file to 210MB binary. That's quite large, but both Netfabb (barely) and Simplify3D could handle it on a good laptop PC.
Meshmixer, Mesh reduction with the "Reduce" tool. Type 90 to reduce down to 10%

In addition to Mesh reduction, you also can make sure that nothing is inside the terrain model. To do so use the Edit/Make solid function. It also does mesh reduction and some smoothing. E.g. using the default values I reduced a 200MB model to a mere 6MB. However, if you want to keep the same outline, the model also can grow. See the next section.

You then also could insert hollow areas inside with Edit/Hollow. This should save printing time (but I did not test the latter so far)

Mesh reduction with Make solid from Meshmixer

This tool does two things. I will create a solid object with an empty interior from a "messy" model and it can do triangle reduction and smoothing of the surface.

As of Nov. 2017, the program crashed with a large file (757MB) using 0.1mm cells. It probably ran out of memory space since the target would have included more triangles and maybe produced a file of several gigabytes.

Therefore we suggest

  • to use another tool to reduce the mesh first (e.g. the Meshmixer procedure explained just above or Meshlab, also described above.
  • to specify larger than 0.1 cells, e.g. 0.2mm for a small model or 0.5mm for large model.
Meshmixer "Make solid" tool

The following settings did work on my laptop PC (DELL XPS 15 with a GTX 1050) with a 200MB STL model of Gran Canaria:

  • 0.2 cells
  • Preserve sharp edges

However the resulting file was a bit larger (250MB)) since it put triangles all over the flat sea and underneath the place. Interestingly, a 10MB model grew to 250MB since it created tiny triangles underneath the plate.

Meshmixer, new model produced with "make solid"

This tool will produce a second, new model. You can hide or remove the old model and then export the new model. Since the resulting model can be much larger than the input model I am not sure if we should suggest using this tool. Or maybe we a better understanding on how to use this.

Meshlab/ Meshmixer example

  • Original STL file size was 775 MB, over 4 Mio triangles

Reduction with Meshmixer

  • We firstly reduced it to 5% using the Meshmixer "Reduce tool" (Click on SELECT, Click on the object, CTRL-A and wait(!), SHIFT-R and wait(!), typed "95" and wait). The resulting file was 10.49MB which is a good size and the structure seem to OK.
  • To be on safe side, we used "Make Solid", using 0.2mm cell size and "sharp edge preserve". This took ages to compute (we aborted a 0.1mm solution). The resulting file grew again to over 200MB.
  • We checked its integrity with its own diagnostic tool and also Netfabb.

Reduction with Meshlab

  • We use quadratic edge collapse to 5% target. The resulting file was also 10.7 MB and also of good quality.

Both software seem to to do mesh reduction allright. Meshmixer seems to do a better job in smoothing than Meshlab. However it may not preserve terrain features as well (we just cannot tell).

Gran Canaria 757MB asci STL file reduced to 10.7 MB files (Meshlab=left, Meshmixer=right)

Conclusion

Either tool can do. Both take their time. The Meshlab version is uglier, but that should not affect slicing. I find Meshlab much easier to use for mesh reduction. For other operations, the opposite is the case: Autocad's Meshmixer is much easier than Meshlab and it has good online documentation.

Below is the picture of a print. I used default settings of the Simplify3D slicer. Extrusion should be have been a bit fatter. Extrusion multiplier was set at 0.9, that is probably about 0.38mm. In simplify3D modify the Extrusion multiplier to 0.95, i.e. about 0.4mm or 1 = 0.42mm. For more fine grained result you could print 0.2mm layers or even less, but that would multiply printing time. Also, 1.5mm layers are more tricky to print (the risk of a nozzle being stuck or filament "drying" up is higher).

Gran Canaria printed (Meshmixer version). 0.25 resolution, 0.9 flow rate

One corner was slightly bent. Getting the first layer right is really crucial. Clean your print bed and maybe add some sticky stuff, heat it more, etc.

Gran Canaria, almost perfect first layers

Slicer and printer settings for digital elevation models

Printing Vulcano with my old but reliable Felix 2 printer

Printing 3D terrain models can be very frustrating. I had 2 print aborts before I managed to print my first bigger than 10x10cm model. In order to reduce the amount of these inevitable failed prints, we suggest a few strategies for PLA or another polymer that does not warp. Note that print properties of various PLA are different. Adapt to your filament.

Make sure that the model is error free

  • Use an STL repair tool, e.g. Netfabb or functionality built into your slicer.
  • Verify g-code, e.g. look at the print preview. If you controller or slicer does not allow this, install a tool that includes the same slicer and that can do it, e.g. Repetier host.I did encounter "freeky" parts like areas printed twice. These will make your print head getting stuck and as a result, a likely print abort. You can easily spot these areas in a gcode viewer, because they look very dense.
Printing the floor. Make sure that it sticks to the platform

First layer adherence and warping

Even PLA can and does warp when you print large surfaces.To increase platform adherence and reduce warping, use the following strategies:

  • Print the first (flat) layer slowly (about 30% of default speed, no more than 20mm/second
  • Ventilator off for the first layer.
  • Make the first layer fatter with extra extrusion about 125 to 150%
  • Print it warmly (e.g. 205 degs. for PLA a new printer, and 215 on a old printer)
  • Print the other layers colder (about 195 degs.) You could go lower than that of course, but then you will have the risk that the flow will "dry" up when you print large infills, since bonding is not so easy at 20% infill and high speed. However, if your extruder is not very strong (most older printers do have rather weak ones), print warmer (e.g. 215 degs).
  • You also can consider adding glue or hairspray to the bed, but then you may have trouble getting the part off the print bed.

Filling and extrusion width

One of the problems with 3D terrain models is that in some printed areas will exceed their expected height (too much extrusion used for flat areas). The print head then will "dig" into the plastic and if you have a second print head it may want to rip off the whole print from the platform. Therefore you will have to rethink the way to print.

  • 20% filling should be enough.
  • Honeycomb patterns seem to lead to better results but may take more time for printing. However they are more sensitive to retraction getting out of touch, i.e. plastic drying up because it doesn't enter in contact with plastic underneath.
  • Reduce infill in other ways, e.g. in Slic3r, you could combine 2 layers and "only fill when needed"
  • Verify default extrusion width. It should be set to the width of the nozzle or a bit higher, e.g. 0.35mm to 0.42 for a 0.35mm nozzle (For Lego I use 0.38mm). However, this setting should be made by a manufacturer supplied profile.
  • Set extrusion to less than "normal" if your landscape has lots of flats. It should be lower than the default width value (see above). But in my experience, these settings also have to change with respect to plastic make (flow is not the same), filament temperature, layer height (?), etc.
    • Simplify3D: "Extrusion width parameter" = 0.95
    • Cura engine does not have an extrusion width multiplier. You could modify "flow", e.g. 0.95% in "Filament" settings or else change shell thickness to a multiple of desired extrusion width. E.g. 1.2mm means 3 X 0.4mm width.
  • Do not print more than 2 top or bottom layers if possible. This may be a problem if you got large flat surfaces and you will have to use 3 for each. Ideally, one should have a slicer that allows styles for various heights and sizes (like the Netfabb slicer we got for the infamous fabbster printer). Open source slicers cannot do this (unless I missed any improvement as of March 2017)
  • You may consider switching off the fan or reducing it. Warmer plastic will reduce print quality, but also reduces the risk of a nozzle getting stuck. You also can consider doing this just for the floor.

Other tips

  • Remove any retraction. On larger prints, I experienced filament drying up. This is probably due to retraction. Each time the filament is pulled back in it has to be pushed out again and after a few hours of printing the hot end may be just warm enough to weaken the plastic a bit. In Slice3R, retraction is set in printer tab (create a new printer profile).
  • Avoid PLA with too much paint inside. That type of PLA not only reduces print quality but also seems to expand more and could possibly include harmful chemicals.
  • Avoid using a double head printer. Since some plastic will coagulate and stick out, the second (cold) print head then can run into one of these bumps and either get stuck or rip the model away, leading to disaster. Unfortunately I don't know how to remove the second hotend without the printer complaining (to do).
  • For very large models, do not use an old PC as controller, e.g. use the SD card. An old computer (e.g. my old Dell Precision laptop I just use for slicing and controlling the printer) sometimes may pause a bit. The print head will stop and plastic will flow out and create a bump which then may lead to the model being displaced.
  • If you own a dual head printer, try to move up manually the second print head if you can do this without having to do major re-calibration work.

Reduce print time

Even a small object can take a long time to print. E.g. it took 10 hours to print a 13x17x1 cm model of the Geneva basin using 0.2mm layers and settings I designed for printing Lego blocks.

  • Consider using 0.25mm layers. For larger models, the result is OK. Use 0.2mm layers or less for small ones.
  • Use all the filling strategies above.
  • Use a controller that allows speeding up manually a print (e.g. Repetier Host) when you feel that everything goes fine. Some printers, e.g. my Felix Pro also allow this through its control screen.
  • Standard speed can be fairly high, e.g. 60mm/s. If your slicer allows, reduce this for small areas. Consider also reducing the outer perimeter, e.g. I use 50mm/s.
  • Use extra speed for filling, e.g. at least 80mm/s
  • Disable any cooling tower or skirt (unless your object is very small).

Printing upside down

  • I did not try this, but this strategy might allow printing sturdier objects with more infill and more layers on top and bottom. However I suspect that will need a good support structure (raft and or something "around"). Also, you cannot use much extra elevation since this would create difficult to print overhangs.
  • As an example I looked at estimated print time for two version of a file: A horizontal model that would take over 8 hours to print with 25% fill only takes about 7 hours with vertical position and 5% fill. The gain is not very impressive, but you could print 3 models at the same time that way (and pray that one of these doesn't get loose).
  • I probably would add a raft or at least a skirt.

Bibliography, links and footnotes

Citations

  1. Harding, C., Hasiuk, F., & Wood, A. (2021). TouchTerrain—3D Printable Terrain Models. ISPRS International Journal of Geo-Information, 10(3), 108. https://doi.org/10.3390/ijgi10030108
  2. Quote: "The CGIAR is a global partnership dedicated to reducing rural poverty, increasing food security, improving human health and nutrition, and ensuring more sustainable management of natural resources. The Consortium for Spatial Information, CSI, is the CGIAR community of geo-spatial scientists that promotes and practices the application of spatial science to achieving these goals most effectively." http://www.cgiar-csi.org/ Feb 2017

Software

(needs to be completed)

STL extraction from DEM
Viewers
Converters
  • AccuTrans3D. Converter for Windows. For only $20 it can convert between lots of file formats. See a section above for using with Swiss Topo 25m data.
  • QGIS has built-in conververters (raster menu -> translate)
  • 3DEM (Windows Vista) can convert from some DEM formats to others. This program still seems to work under Win8.

Links

QGIS Tutorials (merging, repairing, etc.)

Height map Tutorials
Point cloud to STL tutorials
Heat map to STL tutorials
KMZ to STL
General tutorials

3D terrain data

Search and data selection tools
  • Imagico DEM Search. Select a rectangle and a data source. It will provide links to downloadable files.
  • USGS Earth explorer. Select an area on the map, click on data, then select a data source. Registration required.
Selection with STL export
  • Terrain2SL All in one service (explained above). This is the beginner's tool.
  • Terrainator. STL export is commercial
Data provided as area files.