Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Terrain transition problem between patches with basemaps


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 QNAN   Members   -  Reputation: 223

Like
0Likes
Like

Posted 13 January 2012 - 11:33 PM

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.

Posted Image

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:
Posted Image

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.

Sponsor:

#2 QNAN   Members   -  Reputation: 223

Like
0Likes
Like

Posted 16 January 2012 - 02:28 PM

It is hard to believe, that noone encountered this problem before?

Anyone?

#3 froop   Members   -  Reputation: 636

Like
0Likes
Like

Posted 16 January 2012 - 03:00 PM

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.

#4 QNAN   Members   -  Reputation: 223

Like
0Likes
Like

Posted 16 January 2012 - 05:35 PM

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.

#5 Hodgman   Moderators   -  Reputation: 31938

Like
0Likes
Like

Posted 16 January 2012 - 06:47 PM

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.

#6 QNAN   Members   -  Reputation: 223

Like
1Likes
Like

Posted 24 January 2012 - 03:45 PM

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:
Posted Image

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):
Posted Image

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.

#7 Hodgman   Moderators   -  Reputation: 31938

Like
1Likes
Like

Posted 24 January 2012 - 05:39 PM

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 Posted Image

#8 QNAN   Members   -  Reputation: 223

Like
0Likes
Like

Posted 25 January 2012 - 11:42 AM

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 Posted Image




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS