Merge two heightfields seamlessly
1612 3 1- coderfelix
- Member
- 2 posts
- Joined: 6月 2022
- Offline
- play_w_madness
- Member
- 9 posts
- Joined: 8月 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.
(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.
- coderfelix
- Member
- 2 posts
- Joined: 6月 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 - 2023年8月10日 23:06:14
- ctrl
- Member
- 32 posts
- Joined: 5月 2023
- Offline
-
- Quick Links