October 19, 2011
Maperitive: 3D Export

The latest Maperitive beta (download it from here) now contains a new command called export-3d, which generates a 3D mesh using the digital elevation model and places the map texture on top of it. The 3D model is exported into a COLLADA format, which can be imported into various 3D programs (Google SketchUp is the one I mostly used, it’s free).

Quick How-To

The quickest/easiest way to generate a 3D export is to move the map to the area you’re interested in and simply select the Tools | Export To 3D menu command. Maperitive will then generate files in the output/Maperitive3D directory of your Maperitive installation. If you do not load your own OSM vector layer, Maperitive will use OSM tiles, the same ones used to show tne OSM web map.

NOTE: be careful to keep the map area fairly small, otherwise you’ll end up with a 3D model that you won’t be able to import into other software, especially if you don’t have a top-of-the-line computer at your disposal.

Importing Into SketchUp

After opening SketchUp, choose **File | Import…” menu command. NOTE: Before browsing for the file, click on the Options… button and make sure Validate COLLADA file is turned off:

Validation should be disabled because it makes importing unbearably slow, especially for larger models. After you’ve done this, browse to your generated Maperitive3D.dae file and open it.

Depending on the size of your model, you might have to wait for some time for the importing to finish. Sometimes I even have to resort to killing the SketchUp process and regenerating a simpler model.

Configuring SketchUp

After the model has been successfully imported, you may want to tweak a few settings in SketchUp to make the rendering look better:

  • View | Edge Style | Edge - uncheck this so the edges of surfaces are not shown.
  • View | Face Style - choose Shaded With Textures to get the best effect.
  • View | Shadows - check this to turn on the sun shadows.

Tweaking The 3D Model

export-3d command provides additional parameters we can tweak. Type in help-command export-3d into the command prompt and you’ll get the list of those parameters:

COMMAND NAME: export-3d 
DESCRIPTION: generates a 3D map from the current map view and saves it to the disk 
PARAMETERS: 
  output-dir=<the directory where output files will be saved> (text, optional)
  mesh-points=<the maximum number of points the terrain TIM mesh should have> (integer, optional)
  tin-error=<the maximum allowed elevation difference (in meters) when simplifying the terrain TIN mesh (default is 1 meter)> (real number, optional)
  width=<bitmap width> (value, optional)
  height=<bitmap height> (value, optional)
  map-scale=<map scale to use when exporting> (value, optional)
  scale=<graphics scale to use when exporting> (value, optional)
  dpi=<DPI to use when exporting> (value, optional)
  zoom=<zoom level to use when exporting> (value, optional)

Better Bitmap Texture

By setting various bitmap parameters you can increase the resolution of the bitmap and/or the zoom level of the underlying OSM bitmap.

TIN Tweaks

To increase performance, Maperitive uses Garland-Heckbert’s TIN simplification algorithm to simplify the terrain triangulated irregular network (TIN). There are two command parameters that affect the simplification process:

  • tin-error: this is the maximum error (tolerance) allowed between the actual DEM elevation and the generated model, in meters. The default value is 1 meter and if your model becomes too big to handle, I suggest increasing the tolerance value.

  • mesh-points: this is the maximum number of points (vertices) the TIN should have. The simplification algorithm starts from a very simple model (just two triangles) and incrementally adds new points to it. Upon reaching the maximum number of points, the algorithm stops (regardless of the tin-error setting). This is a safeguard against the model going wild with too many points. So I suggest experimenting with those two values to get something workable for your case.

Setting The Map Area More Precisely

Instead of relying on the map window to act as your area of interest, you can specify printing bounds (right click on the map) and move them to an exact position of your choice.

Final Notes

This 3D export function is by no means of the same quality as some other OSM 3D projects - you don’t get any 3D objects apart from the terrain model, so don’t expect to see any 3D buildings, trees etc. It is, however, a very simple tool to use (I hope) and it produces an output in a fairly open standard (COLLADA) which can then be tweaked with other software.

The next logical step would be to include the things like roads and buildings as actual 3D objects, but I will leave that for the future since my task list already very full with other features.

Please send me feedback if you find this feature useful (or indeed if you find it crappy). Since all this is beta, expect to find bugs. Also, if you’re more of an expert in 3D field than me, a question for you: can you recommend any (preferably free) tool for raytracing which can consume COLLADA files generated by Maperitive?

  1. small-business-apps reblogged this from braincrunch
  2. philippines-seo-services reblogged this from braincrunch
  3. seo-victoria reblogged this from braincrunch
  4. voguedoubleglazing reblogged this from braincrunch
  5. fuckyeahcartography reblogged this from braincrunch
  6. braincrunch posted this