Multiple terrains seams

XpLoDWilD

28-03-2009 18:26:13

Hi everybody,

I'm trying to put multiple terrains together, but as you can see on this picture :



I'm unable to have seamless between terrains. I started searching something to set same terrains edges height, but I didn't found anything useful (since it's not possible to have direct access to edges height).

Is there a way to make seamless terrains ?

CABAListic

28-03-2009 19:48:31

Not with ETM v2, no, unless you disable LOD. You do have to ensure that the values at the borders of your heightmaps are exactly equal, this is your responsibility. But even then, different LOD levels of neighbouring terrains are not handled in ETM which will result in visible gaps.

XpLoDWilD

28-03-2009 20:01:36

But is there a way to set edges to same height ? So that the gaps between different terrains would be less visible ?

CABAListic

28-03-2009 22:42:42

Well, simply set them to the same height? After all, you control the heightmaps of the two terrains. It's your responsibility, ETM can't help you there.

XpLoDWilD

29-03-2009 10:44:20

Right, I didn't saw setHeights and getHeights functions (or, at least didn't understand how they works). Thanks.

I finally got it to work, using something like this (if someone is interested) :


void Zone::fixSeams()
{
Ogre::Image img;
img.load("AllWhite.png", "ET");
img.resize(1, 1);
ET::Brush brush = ET::loadBrushFromImage(img);

for (std::vector<Terrain*>::iterator it = m_terrains.begin(); it != m_terrains.end(); ++it)
{
int currentTileX = (*it)->getTilesetX();
int currentTileY = (*it)->getTilesetY();

for (std::vector<Terrain*>::iterator its = m_terrains.begin(); its != m_terrains.end(); ++its)
{
if ((*its)->getTilesetX() == currentTileX+1)
{
for (int i = 0; i < 257; i++)
{
// Get brush at absolute right
(*it)->getTerrainMgr()->getHeights(256, i, brush);

// Set brush at left
(*its)->getTerrainMgr()->setHeights(0, i, brush);
}
}
}
}
}



Seams are fixed (more or less), but I have still a problem :



As you can see, I've a little problem with lighting... What should I do to fix that ? I'm using Caelum, and initialize my terrains like this :


mTerrainMgr->createTerrain(terrainInfo, 33, 255, true, true);


I don't use Lightmaps, and applied fix for lighting found in this forum (I don't remember which one exactly).