Merge two heightfields seamlessly

   1538   3   1
User Avatar
Member
2 posts
Joined: June 2022
Offline
Hi, I tried to merge two heightfields together seamlessly, but didn't get a perfect solution (using heightfiled projection or Boolean), since the edges between them are hard to blend properly.

Is there any way to merge/blend two heightfields perfectly & seamlessly?

Attachments:
1.png (706.5 KB)

User Avatar
Member
9 posts
Joined: Aug. 2016
Offline
(1) If you can overlap your height maps, you can do linear interpolation between the two over the area of their overlap.

(2) If not, you can introduce a third height map on their seam that would overlap with both of your height maps.
It should be a "neutral" (i.e. lacking distinct features) noise roughly the same frequency as the two height maps you already have.
Let's call your two maps A and B, and the new extra map C. Then on the overlap of A and C you interpolate the new value from (A) to (C + held edge value of B), and vice versa for B.

In both cases the seam won't be "perfect", but wider overlap areas will result result in smoother transitions at the cost of features on the overlapped areas.

In (2) the third map is required to make the interpolation happen between to changing values instead of between changing value and const.

I've attached a hip file with an example of the second algorithm.

Attachments:
Screenshot_20230809_134802.png (550.6 KB)
HeightFieldBlend.hiplc (168.0 KB)

User Avatar
Member
2 posts
Joined: June 2022
Offline
play_w_madness
(1) If you can overlap your height maps, you can do linear interpolation between the two over the area of their overlap.

(2) If not, you can introduce a third height map on their seam that would overlap with both of your height maps.
It should be a "neutral" (i.e. lacking distinct features) noise roughly the same frequency as the two height maps you already have.
Let's call your two maps A and B, and the new extra map C. Then on the overlap of A and C you interpolate the new value from (A) to (C + held edge value of B), and vice versa for B.

In both cases the seam won't be "perfect", but wider overlap areas will result result in smoother transitions at the cost of features on the overlapped areas.

In (2) the third map is required to make the interpolation happen between to changing values instead of between changing value and const.

I've attached a hip file with an example of the second algorithm.

Many thanks to you! Quite a clever solution.
I got a similar solution like what you said , which is building a extra huge heightfiled C, and projecting A & B on C, then extract the seam areas and blur / noise them.
Edited by coderfelix - Aug. 10, 2023 23:06:14

Attachments:
13.png (1.0 MB)

User Avatar
Member
22 posts
Joined: May 2023
Offline
I think Heightfield Layer is the way to go here, gives you a few different options for the operations to use when blending.
You do need a bit of overlap which you can control with a mask that you blur.
You can combine the layers using a hf tilesplice.

Attachments:
HeightField_Layer_Blend.hipnc (192.2 KB)

  • Quick Links