I'm working to take assets imported using BlenderGIS and then work on them with Armory, so I can interact with the terrain and fly through it. Due to the size of some of the rasters 20000+ pixels I am hitting WebGL limitations within Armory exports.
To resolve this, I attempted to cut my Heightmap up in QGIS and load individual tiles with BlenderGIS, but I got the following gaps between DEM's which were impossible to join:
I spotted this had been mentioned before in following posts:
https://github.com/domlysz/BlenderGIS/issues/24
https://github.com/domlysz/BlenderGIS/issues/98
So I switched between pxLoc='CENTER' and Loc='CORNER' in operators/io_import_georaster.py but neither made a difference.
So I took your advice in one of the posts and just imported the whole heightmap and looked for another route to tile. Having found this script I was able to slice up the mesh into 16 tiles (seperate objects):
import bpy, bmesh
from bpy import context
from mathutils import Vector
# bounding box helper methods
def bbox(ob):
return (Vector(b) for b in ob.bound_box)
def bbox_center(ob):
return sum(bbox(ob), Vector()) / 8
def bbox_axes(ob):
bb = list(bbox(ob))
return tuple(bb[i] for i in (0, 4, 3, 1))
def slice(bm, start, end, segments):
if segments == 1:
return
def geom(bm):
return bm.verts[:] + bm.edges[:] + bm.faces[:]
planes = [start.lerp(end, f / segments) for f in range(1, segments)]
#p0 = start
plane_no = (end - start).normalized()
while(planes):
p0 = planes.pop(0)
ret = bmesh.ops.bisect_plane(bm,
geom=geom(bm),
plane_co=p0,
plane_no=plane_no)
bmesh.ops.split_edges(bm,
edges=[e for e in ret['geom_cut']
if isinstance(e, bmesh.types.BMEdge)])
bm = bmesh.new()
ob = context.object
me = ob.data
bm.from_mesh(me)
o, x, y, z = bbox_axes(ob)
x_segments = 4
y_segments = 4
z_segments = 1
slice(bm, o, x, x_segments)
slice(bm, o, y, y_segments)
slice(bm, o, z, z_segments)
bm.to_mesh(me)
bpy.ops.object.mode_set(mode='EDIT')
bpy.ops.mesh.separate(type='LOOSE')
bpy.ops.object.mode_set()
And started importing sat images that I had already split into tiles within QGIS, this appeared to look nice and worked well:
However when I zoomed into the edges I had a similar gap issue:
I feel like I'm getting closer but would appreciate a little help trying to reduce the gap issues.
The entire sat image in this test is 10000 x 10000 and each tile is 2500 x 2500.
I'm using the following python extract the square HM from the source asc:
import os
os.system(r'''gdalwarp -t_srs EPSG:32758 -wo SOURCE_EXTRA=1000 -tr 8.0 8.0 -dstnodata "0.0" -r cubic -ot Float32 -of GTiff -te 644784.498133 4979531.810674 654784.498133 4989531.810674 "D:/Arma/QGIS/NZ/Doubtful_Sounds/DEM/nz-8m-digital-elevation-model-2012.asc" D:/Arma/QGIS/NZ/Doubtful_Sounds/grid/DEM/square.tif''')
And the following to generate tiled sat images:
import os
os.system(r'''gdalwarp -t_srs EPSG:32758 -wo SOURCE_EXTRA=1000 -tr 1.0 1.0 -r cubic -of GTiff -te 644784.498133 4987031.810674 647284.498133 4989531.810674 D:/Arma/QGIS/NZ/Doubtful_Sounds/11_05_19/merged_sat.tif D:/Arma/QGIS/NZ/Doubtful_Sounds/grid/DEM/sat1a.tif''')
I'm running Blender 2.8 with your latest BlenderGIS build. Projection on the project is QGS 84 / UTM zone58S
.blend file for reference:
https://1drv.ms/u/s!AjCedBZJ5Eh4i3-eifFqf19IZefa
A couple of the Sat tiles:
https://1drv.ms/u/s!AjCedBZJ5Eh4jADXJQmz8O3lyLja
Entire square .asc heightmap:
https://1drv.ms/u/s!AjCedBZJ5Eh4jADXJQmz8O3lyLja