# Seamlessly stitch two HeightFields

## Recommended Posts

Hey magicians, how would you seamlessly stitch two different heightfields using Vex (or VOPs)? Any ideas would be hugely welcomed!

Edited by Neikke
##### Share on other sites

• Neikke changed the title to Seamlessly stitch two HeightFields

Hi Natiq,

maybe there is a node for this, but you could overlap both height fields and sample them into a new one:

```float band = chf('band');

float h_0 = volumesample(1, 'height', v@P);
float h_1 = volumesample(2, 'height', v@P);

float mask = smooth(-band, band, v@P.x);

##### Share on other sites

2 hours ago, konstantin magnus said:

Hi Natiq,

maybe there is a node for this, but you could overlap both height fields and sample them into a new one:

```float band = chf('band');

float h_0 = volumesample(1, 'height', v@P);
float h_1 = volumesample(2, 'height', v@P);

float mask = smooth(-band, band, v@P.x);

Hey thanks a lot Konstantin! But will this method work if I need to stitch 6 height maps in this way? I marked areas that need to have perfectly matching relief accordigly:

Do you have an idea how to approach this?

##### Share on other sites

Copy the height fields to the points of an octahedron to shape a cube, apply noise there and assign them to a cross.

Alternatively try sampling the world position noise from a cube mesh right away:

```int index[] = array(0,2,1,3,5,4);

vector bb = relbbox(0, v@P);
vector uvw = set(bb.x, bb.z, 0.0);
vector pos = primuv(1, 'P', index[i@primnum], uvw);
float height = noise(pos * 50.0) * 200.0;

f@density = height;```

##### Share on other sites

Great thanks I will check that! Thanks a lot!

##### Share on other sites

1 hour ago, Neikke said:

Great thanks I will check that! Thanks a lot!

I think you would still need to correct the point numbers to really make all the tiles match, but yeah, I'm glad it's useful.

##### Share on other sites

You could us the heightfield layer node to blend them together, overlap them a bit and then just paint a mask to control where the blend happens.

However, you might be better off just making one big terrain and then making a cross shape extrude it up and use a hf cutout by object.  If that works (I havent tried it) you would no longer have seams on any of the inner edges.

For the outter edges maybe this is easier to solve as a texturing problem?

Write out the Heightfield to disk and then in PS or in COPs, basically clone stamp the edges to get rid of any seams.  Then bring the new seamless texture back in through a heightfield file node.

##### Share on other sites

• 3 weeks later...
On 3/8/2023 at 2:49 PM, Richard said:

You could us the heightfield layer node to blend them together, overlap them a bit and then just paint a mask to control where the blend happens.

However, you might be better off just making one big terrain and then making a cross shape extrude it up and use a hf cutout by object.  If that works (I havent tried it) you would no longer have seams on any of the inner edges.

For the outter edges maybe this is easier to solve as a texturing problem?

Write out the Heightfield to disk and then in PS or in COPs, basically clone stamp the edges to get rid of any seams.  Then bring the new seamless texture back in through a heightfield file node.

Thanks that totally makes sense. I'm not too familiar with COPs but it's definitely possible in PS or in Substance Designer. Thanks a lot for your help!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×