Creating .STL Files from Topography
This article was contributed by Jeff Burnham, P.E., Hydraulics Applications Engineer
Figure 1. Final .stl generated from point cloud
This article demonstrates a way to convert topographic point clouds to .stl file format using FLOW-3D’s TOPO2STL utility. The four main parts of the method are (1) pre-conditioning the point cloud to get the best results, (2) converting the cloud using TOPO2STL, (3) post-conditioning the .stl file before using it in FLOW-3D simulations, and (4) comparing the .stl file to the original point cloud for quality control. Some additional free tools are used for pre- and post-conditioning the topography.
Example Process: Rio Grande River Scale Model
The example point cloud file (Figure 2) can be downloaded from the FLOW-3D Users Site on the Tutorials page, along with a detailed exercise that expands on this note. The example topography is ground-based LiDAR of a scale model of the Middle Rio Grande River in New Mexico, built at the Colorado State University Engineering Research Center as part of a joint project of the U.S. Bureau of Reclamation and Colorado State University. The raw data was provided by Dr. Amanda Cox.
Figure 2. Scale model LiDAR data colored by elevation in MeshLab
The data was first checked and pre-conditioned using the open-source free software MeshLab and CloudCompare. Pre-conditioning the point cloud included:
- Converting the text data to the format required by TOPO2STL
- Manually removing unwanted outlying points, surveying equipment, bystanders, and overlapping surveys (Figure 3)
- Adding a plane of points in the areas outside the river that did not include data (Figure 4)
- Pre-sampling to reduce the number of points used for conversion
Pre-conditioning the point cloud makes conversion 50 – 100 times faster and gives smoother output as illustrated in Figure 5.
Figure 3. Unwanted points were manually removed using MeshLab
Figure 4. Empty regions were pre-filled with higher-elevation points using MeshLab
Figure 5. Pre-conditioning gives faster and better .stl output (right) than without (left)
The pre-conditioned point cloud was converted to .stl format used TOPO2STL, which comes with FLOW-3D and can be launched from the Utilities menu at the top of the interface. The spatial resolution of the conversion was set to the same resolution of the pre-sampling.
Post-conditioning the converted .stl file included:
- Recombination of facets in the non-river bounding plane using MeshLab to reduce the file size by 50%
- Repair of small holes, mismatched facet edges, and incorrect facet normals using netfabb Studio Basic, MeshLab, and pyAdmesh (which is included with FLOW-3D): the first two programs gave slightly better output than pyAdmesh
- Conversion of the ASCII-type .stl to binary format using pyAdmesh, which reduced the file size by 80%
The final step in the process was comparison of the repaired .stl file to the original point cloud with CloudCompare (Figure 6). The mean difference between .stl and point-cloud elevations was about 0.3 mm and the standard deviation of disagreement was about 3 mm.
Figure 6. Disagreement in point and .stl surface elevation: 0 error (blue) to > 1 cm (red).
For two bends in the river: downstream (left) and upstream (right).
Conclusions & Summary
This Hints & Tips article described a four-part approach for converting large topographic point clouds to 3-D .stl format. Specific advice:
- Better conversion speed and better accuracy can be achieved by pre-conditioning the data set
- Smaller file-size can be achieved by post-conditioning the .stl output
- Statistical comparison of the output to the input shows the conversion process is accurate
The methods were tested on a 15-million point river (the Middle Rio Grande scale model shown here), a 61-million point watershed (Dalalven river), and several other data sets. A detailed exercise covering all the recommended steps is available on the FLOW-3D Users Site on the Tutorials page.