Terrain transition problem between patches with basemaps

Started by
6 comments, last by QNAN 12 years, 2 months ago
I am currently implementing basemaps (as opposed to detailmaps) on my terrain.

But I have problems in the transitions from one patch to the next, where one basemap meets the next.
The problem is a sharp line that arises.

I implemented the usual workaround on borders, where you copy the border of one map to the neighbour, so that the map is identical on each side of the border. Together with clamping this works - but only on the top level of the mip-chain.

miplvl0.jpg

As can be seen from this screenshot (red color is only to make what I am working with very visible), as soon as the toplevel mipmap fades out, the problem persists.

I thought: "OK, no problem, I will just do the same for all miplevels!".
But of course that wouldn't go over that easily as seen in this screenshot:
mipall.jpg

As can be seen, the border will carry more and more weight as each mipmap gets smaller and smaller. The border is still one pixel wide, no matter if the map is 512 or 16, making the border heavier and heavier the further out in the distance you see. As can be seen by the hockeystick shape the grass border gets.

I thought then, that maybe the copied border on the top miplevel would have to be "baked" into the rest of the mip-chain, so I tried next to re-create the mip-chain after setting the top-level mipmap. It can be done, but the effect is not convincing. The border with the neighbour is not identical, and that is what it takes for the seam not to be visible.

Is there any way to solve this fairly easily?

Thanks in advance.
Advertisement
It is hard to believe, that noone encountered this problem before?

Anyone?
Since each mip level is half the size of the previous one, you must make sure the texture borders are identical throughout the whole mip chain.
I did. As you can see from my description, that is exactly what results in the 2nd screenshot: A hockeystick shape resulting from a border, that gets more and more weight the smaller the mipmap becomes. As you can see, it is seamless, so that is not what the problem is.

Im looking for a way to make it seamless while at the same time losing the hockeystick shape.
To do this correctly, you'd have to take the neighbouring 'tile' into account properly when generating your mips.

The straighforward way to do this would be to make a texture that is 3x as large as a single tile, and then load 9 tiles into it (the one you're currently interested in processing and its 8 neighbours). You can mip this texture down to a 3x3 pixel image, and then cut the centre 1/3rd out of each mip level to reform the original input tile.
Sorry for the late reply.
I began working on something else while awaiting feedback, and after that it took some time to implement my final solution.

I tried Hodgman's solution, but it is not good enough. For the seams to go away, the pixels on each side MUST be identical, and toying with mip-levels across borders will not on its own make the seams disappear. And if you copy borders after that, you will get the exact same artifact as what I described above.

My solution was to instead average the borders on each side of the seam. At least the "hockeystick" will get distributed on both sides (see next screenshot) and will therefore be less heavy. I choose to only copy the first 4 levels of the mipmaps (out of 11 with a 512x512 texture) so that it is seamless a decent distance, without the artifact getting too heavy. out in the distance, I don't think the seams will be noticed, with bumpy terrain and colors already about the same colors on each side - at least I didn't notice anything, even when looking carefully, knowing exactly where the seam is.

This is how it will look with averaging the color of the two borders:
flatred.jpg

As can be seen, there is still an effect, but it is now distributed on each side. As I use the technique on only 4 levels, it does not get that heavy. It is only because I use the red color while debugging, that the line beyond is so obvious.

This is how it will look on a "live" terrain (look for small red dots I placed at the beginning and end of the map to show where the seam is):
natural.jpg

It looks quite convincing, also when moving. I don't notice anything unnatural.
Without knowing any special shader technique to make a better result, this is the best I could come up with.
Thanks for sharing your solution.
It is hard to believe, that noone encountered this problem before?
I was playing some Battlefield 3 last night, and indeed noticed this artefact on their terrain, so I guess a lot of people just put up with it laugh.png
Hodgman, thanks for the input.
I am glad to hear that a new game like BF3 is also fighting with problems like this. That makes it easier for me to accept my solution smile.png

This topic is closed to new replies.

Advertisement