Challenges with Importing 3d Terrain Mesh

Hi all - this is my first post, but I’ve been reading through community advice for a bit now and wanted to say THANK YOU for chipping in and answering questions.

I’ve been trying to create a basic, interactive XR scene using real-world map data, and have been having a lot of trouble on a few levels:

  • const largeGround = BABYLON.MeshBuilder.CreateGroundFromHeightMap() approach is successful in creating maps of regional scale (and making scaling possible), but the resolution doesn’t work well
  • I’ve exported a blender file in the style that I want to glb, but once imported, can’t scale it (despite reading previous questions and trying mesh.scaling.y = etc., which makes me extremely nervous for the value-added work I’d like to do once it’s in)
  • When I try to export simpler blender files, I run into issues with the height data not being read properly (not sure why that is exactly).

The immediate question I’m up against is: what could be happening in my blender export of the model in preferred format that is making it impossible to scale it?

The more general question I have is: if you were looking to create a 3d map with interactive subsegments using BablyonJS, where would you create assets and how would you manage them so that UI, map meshes, and basic animations worked together? I’m looking to get ahead of what I assume could be exponential pain later in getting settings to work together.

Thank you!

Hello and welcome :wink:

Can you share a repro in the Playground of your mesh scaling issue? I’m pretty sure we can help esaily here

Can you also share your model maybe so our Blender experts can help (wink wink @PirateJC )

Doc on how to reference external resources in the PG: Using External Assets In the Playground | Babylon.js Documentation (babylonjs.com)

That didn’t work. Let me try something else.

Here’s a screenshot of the model in blender (I can’t upload the .blend file).

This imports into Babylon Sandbox as a pizza box (i.e. no height maps)

I’m working on sharing the sandbox now.

1 Like

Do you have a transform in Blender you should bake in ?

I’ve baked in all Transforms. Still pizza box.

Here’s the PlayGround which shows the scaling issue as well: https://playground.babylonjs.com/#KBS9I5#19936

so the scaling is easy :slight_smile:
Create a Simple World Series | Babylon.js Playground (babylonjs.com)

For the height map: I believe your blender file may use something (displacement map?) not supported by gltf

Displacement did actually work - I found a box I hadn’t ticked so you were correct about the Blender issue there (thanks!)

Scaling also works nicely now. Where can I find documentation on the meshes.forEach part?

that is a pure JS feature :wink:
Array.prototype.forEach() - JavaScript | MDN (mozilla.org)

ahhh thank you!