Jump to content

Seamlessly stitch two HeightFields


Recommended Posts

  • 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);
f@height = lerp(h_0, h_1, mask);

 

hf_blend.hip

Link to comment
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);
f@height = lerp(h_0, h_1, mask);

 

hf_blend.hip 171.73 kB · 3 downloads

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:

unknown.png

 

Do you have an idea how to approach this? 

 

Link to comment
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.

cube.png.5b1aa18e42eebf7f76681bbe3b13621b.png cross.png.21e25fbb65042045b26fe7373ad7cf0b.png

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;

 

heightfield_cube.hipnc

  • Like 1
Link to comment
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. 

  • Like 1
Link to comment
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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...