# CreateGroundFromHeightMap - height texture sampling problem

**URL:** <https://forum.babylonjs.com/t/creategroundfromheightmap-height-texture-sampling-problem/43413>\
**Category:** Questions\
**Created:** [August 18, 2023, 4:10pm UTC](https://forum.babylonjs.com/t/creategroundfromheightmap-height-texture-sampling-problem/43413 "2023-08-18T16:10:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jozef\_Plata](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jozef_plata/32/30733_2.png) [@Jozef\_Plata](https://forum.babylonjs.com/u/Jozef_Plata)\
**Post date:** [August 18, 2023, 4:10pm UTC](https://forum.babylonjs.com/t/creategroundfromheightmap-height-texture-sampling-problem/43413/1 "2023-08-18T16:10:34Z")

</div>

Hi.

So when I put all my generated height meshes together, I can clearly see there is some issue with sampling the texture over the borders. It looks like this:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/e/9efe44bf34556c07c78ba2098c3c3a96c7eb9e79.jpeg)

And because `MeshBuilder.CreateGroundFromHeightMap` takes just a texture path (not the BABYLON.Texture class) I don’t have access to the texture.

Is there anything I can do about it?

> **[Babylon.js Playground](https://playground.babylonjs.com/#IDU73Q%2334)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![Jozef\_Plata](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jozef_plata/32/30733_2.png) [@Jozef\_Plata](https://forum.babylonjs.com/u/Jozef_Plata)\
**Post date:** [August 18, 2023, 9:19pm UTC](https://forum.babylonjs.com/t/creategroundfromheightmap-height-texture-sampling-problem/43413/2 "2023-08-18T21:19:13Z")

</div>

I think that the texture for the `MeshBuilder.CreateGroundFromHeightMap` needs access to the wrap mode. This helped me to achieve a something I wanted:

```auto
            mix.mixTexture1.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
            mix.mixTexture1.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
            mix.mixTexture2.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
            mix.mixTexture2.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;

```

But since there’s no access to the displacement map…At least I cannot find it anywhere inside the generated mesh object.

Here’s how it should look like (no bad pixels on the edges of the textures). Ofcourse I’m not using the height maps here, just a .glb mesh instead.

> **[Babylon.js Playground](https://playground.babylonjs.com/#IDU73Q%2336)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes
