Terra has seams when tiled, offsets corrected already

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
Nickak2003
Goblin
Posts: 272
Joined: Thu Jun 10, 2004 4:19 am
x 26

Terra has seams when tiled, offsets corrected already

Post 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?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Terra has seams when tiled, offsets corrected already

Post 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);
Nickak2003
Goblin
Posts: 272
Joined: Thu Jun 10, 2004 4:19 am
x 26

Re: Terra has seams when tiled, offsets corrected already

Post by Nickak2003 »

It is an issue to do with the height-alignment rather than xz. xz is aligned. Height is not always aligned.
Nickak2003
Goblin
Posts: 272
Joined: Thu Jun 10, 2004 4:19 am
x 26

Re: Terra has seams when tiled, offsets corrected already

Post by Nickak2003 »

Maybe the gimp plugin doesn't do precise seemless?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Terra has seams when tiled, offsets corrected already

Post 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.
Nickak2003
Goblin
Posts: 272
Joined: Thu Jun 10, 2004 4:19 am
x 26

Re: Terra has seams when tiled, offsets corrected already

Post 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.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Terra has seams when tiled, offsets corrected already

Post 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
Nickak2003
Goblin
Posts: 272
Joined: Thu Jun 10, 2004 4:19 am
x 26

Re: Terra has seams when tiled, offsets corrected already

Post by Nickak2003 »

It was indeed an off by one error, good job, thanks.
Post Reply