This blender script will produce a series of .obj files in a grid from a hight map image
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
All you need to use this script is Blender. You can find instructions for installing blender here
Just clone this repository onto you machines either using the clone button at the top of this page or:
git clone https://github.com/meredityman/3DVilnius.git
You should also make sure that blender can be called from the command line.
blender -v
If you get an error you should make sure to add it to your path.
You can run python script in an existing blender file. This will enable you to check the output.
cd Scripts
blender ..\Blender\Example.blend --python HeightMap2Mesh.py -- ../Data/Images/Vilnius.png ../Data/Models
Alternatively you can run the process in the background, without specifying a .blend file. Then the programmer with run placing .obj files in the specified directory, in this case /Data/Models
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius.png ../Data/Models
The default output should look something like this.
The elevation data used in these examples was taken from the Copernicus Land Monitoring Service - EU-DEM.
You can specify a few options in the command line to control the output. You can view these like this.
blender --background --python HeightMap2Mesh.py -- -h
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius-Map.png ../Data/Models
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius-Roads.png ../Data/Models
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius.png ../Data/Models --render ../Data/Renders
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius.png ../Data/Models --mesh_density 0.5
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius.png ../Data/Models --displace_strength 50
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius.png ../Data/Models --grid_size 2
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius.png ../Data/Models --print_size 5
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius.png ../Data/Models --print_thickness 15
blender --background --python HeightMap2Mesh.py -- ../Data/Images/Vilnius-Roads.png ../Data/Models --reverse