Page 1 of 1

Terra has seams when tiled, offsets corrected already

Posted: Tue Feb 16, 2021 4:08 pm
by Nickak2003
I have tiled four terras to form a large square, the edges do not meet up sometimes.
https://ibb.co/88fh61Z


i have tiled the terras with:

Code: Select all

			Ogre::Vector2 pos = tilePos * (terra->getXZDimensions() - terra->getRelativeSize());
			tileOrigin.x = pos.x;
			tileOrigin.z = pos.y;

I have tried using heightmaps generated in GIMP, using the filter>map>tile seamless

The two meshes do not seem to meet sometimes.

Here's my heightmap:
https://ibb.co/BNxLJ63

what to do?

Re: Terra has seams when tiled, offsets corrected already

Posted: Tue Feb 16, 2021 5:37 pm
by dark_sylinc
Mmmm I'm at a loss (I'm using multiple terras and never seen they don't match).

Does it get fixed if you try alternatives like...?

tilePos * (terra->getXZDimensions() - terra->getRelativeSize() * 0.5f);
tilePos * (terra->getXZDimensions() - terra->getRelativeSize() * 1.5f);
tilePos * (terra->getXZDimensions() - terra->getRelativeSize() * 2.0f);

Re: Terra has seams when tiled, offsets corrected already

Posted: Tue Feb 16, 2021 6:21 pm
by Nickak2003
It is an issue to do with the height-alignment rather than xz. xz is aligned. Height is not always aligned.

Re: Terra has seams when tiled, offsets corrected already

Posted: Tue Feb 16, 2021 6:27 pm
by Nickak2003
Maybe the gimp plugin doesn't do precise seemless?

Re: Terra has seams when tiled, offsets corrected already

Posted: Tue Feb 16, 2021 7:36 pm
by dark_sylinc
Mmmm then the outer limits are not drawing skirts.

I can see how that would happen. Normally the skirts are facing inwards rather than outwards. But this isn't a 2 minute fix. I'll try to think if there is a quick fix.

A possibly-expensive workaround could be to turn culling mode to none for the terrain.

Re: Terra has seams when tiled, offsets corrected already

Posted: Wed Feb 17, 2021 1:47 am
by Nickak2003
I think it has to do with the vertexes not lining up for some reason, on the y/height axis. I don't see how this could be skirting, though? Sometimes they do line up, it seems to be in specific cases where it fails.

Re: Terra has seams when tiled, offsets corrected already

Posted: Wed Feb 17, 2021 3:50 am
by dark_sylinc
By design between LOD changes there are discontinuities (holes), and skirts hide these holes.

However if they are not there, then the holes will be visible.

Oh wait! I think I know what's going on. GIMP seamless is not producing what you need. It is indeed seamless, but not what you need (it is off by one).

The problem is the following: let's assume a 8x1 texture, GIMP will produce the following:

Code: Select all

0 1 2 3 4 3 2 1
This is indeed seamless. If you put two 8x1 textures together in a row you will get the following:

Code: Select all

0 1 2 3 4 3 2 1 0 1 2 3 4 3 2 1
However this is not what you need. What you need is the following:

Code: Select all

0 1 2 3 4 3 2 1 0 0 1 2 3 4 3 2
Notice that the 0 in the middle is repeated. (and that now the 2nd texture ends in 2 instead of 0). That is what you need. The borders need to have the exact same value.

At least I suspect this could be what's happening.

Cheers
Matias

Re: Terra has seams when tiled, offsets corrected already

Posted: Wed Feb 17, 2021 5:49 pm
by Nickak2003
It was indeed an off by one error, good job, thanks.