Create 3D models (.obj, .glb, etc.) from terrain maps using a python script in Blender.
Interact with the models through the web or mobile using Google Poly
A library of HiRISE 3D models can be found here: https://poly.google.com/user/2E_yxXvhmYl
The models can be quickly exported to .stl
for 3D printing
- Blender
- Windows 3D Builder (or equivalent)
Delete the numpy
folders in:
C:\Program Files\Blender Foundation\Blender\2.79\python\lib\site-packages
Change Directory:
C:\Program Files\Blender Foundation\Blender\2.79\python\bin
Then run:
python.exe -m ensurepip
python.exe -m pip install scipy
python.exe -m pip install scikit-image
- commands may vary depending on OS
Download the CA (Color Altimetry) and AB (Annotated Browse) data like the links below
Use this little script to remove text from the original images before creating a new mesh
import numpy as np
from scipy import ndimage
cdata = ndimage.imread("DTEEC_019358_2225_018857_2225_U01.ca.jpg")
data = ndimage.imread("DTEEC_019358_2225_018857_2225_U01.ca.jpg",mode="F")
labels, features = ndimage.label(data>10)
group_size = []
for i in range(features):
group_size.append( np.sum(labels[labels==i]) )
mi = np.argmax(group_size)
mask = labels==mi
data[~mask] = 0
cdata[~mask] = (0,0,0)
data2 = ndimage.imread("DTEEC_019358_2225_018857_2225_U01.ab.jpg",mode="F")
dmask = mask[:, abs(mask.shape[1]-data2.shape[1]): ]
data2[~dmask] = 0
cd = cdata[:, abs(mask.shape[1]-data2.shape[1]): ]
alt = np.copy(data2)
-
Run the script blender_terrain.py from within blender after downloading the data.
-
Export model to .glb
-
Open in Windows Builder 3D
-
Select the mesh, it will appear as a solid color
-
Paint> Texturize > Upload Image
-
Coverage 100% and add texture to mesh
-
Save as glb
If your Blender model appears as a solid color make sure you switch the Viewport Shading to material