Min & Max Values for CreateGroundFromHeightMap

Hello all,

I hope everyone is staying safe these days! I’ve been playing around the CreateGroundFromHeightMap function to create 3D models based on DEM rasters. In QGIS I’m able to see the height range, as seen in this picture, but when these values are put into the function’s minHeight / maxHeight parameters the model seems vertically stretched more than it should.

I was wondering how Babylon’s ground from heightmap function works with these values, so I can maintain as much accuracy as possible.

Thanks for your time!

It is all in here: Babylon.js/groundBuilder.ts at master · BabylonJS/Babylon.js · GitHub

and mainly here:

maybe that is the computation of the gradient using all colors of the textures ?

1 Like

I think I prematurely clicked “solution” haha. Definitely a point in the right direction. I’ll have to wrap my head around this and try again. Thanks for the resource!

1 Like

@sebavan So I believe the issue was do to incorrect scaling of the mesh plane. Looking good now! Thanks for linking the GitHub resource; I have a better understanding how the RGB values are handled.

Take care!