I'm using terrain paging with an orthophoto as a diffuse texture for the terrain.
Code: Select all
//-------------------------------------------------------------------------------------
void City_Paged::defineTerrain(long x, long y)
{
String filename = mTerrainGroup->generateFilename(x, y);
if(ResourceGroupManager::getSingleton().resourceExists(mTerrainGroup->getResourceGroup(), filename))
{
mTerrainGroup->defineTerrain(x, y);
}
else
{
Image img ;
loadHeightmap(x, -y, img);
TerrainMaterialGeneratorA::SM2Profile* matProfile = 0;
matProfile = (TerrainMaterialGeneratorA::SM2Profile*) mTerrainGlobals->getDefaultMaterialGenerator()->getActiveProfile();
if (matProfile)
{
matProfile->setLayerParallaxMappingEnabled(false);
}
Terrain::ImportData* importData = OGRE_NEW Terrain::ImportData();
importData->terrainSize = TERRAIN_SIZE;
importData->worldSize = TERRAIN_WORLD_SIZE;
importData->inputScale = 200;
importData->minBatchSize = 33;
importData->maxBatchSize = 65;
importData->layerList.resize(1);
importData->layerList[0].worldSize = TERRAIN_WORLD_SIZE;
loadDiffuseTexture(x, -y, *importData);
mTerrainGroup->defineTerrain(x, y, &img, &importData->layerList);
mTerrainsImported = true;
}
}
//-------------------------------------------------------------------------------------
void City_Paged::loadHeightmap(int x, int y, Image& img)
{
char heightmap[255];
_snprintf(heightmap, 255, "terrain/City_06/hm/City_heightmap_%d_%d.png", x, y);
img.load(heightmap, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
}
//-------------------------------------------------------------------------------------
void City_Paged::loadDiffuseTexture(int x, int y, Terrain::ImportData& importData)
{
char diffusemap[255];
_snprintf(diffusemap, 255, "terrain/City_06/or/City_texture_%d_%d.DDS", x, y);
importData.layerList[0].textureNames.push_back(diffusemap);
}
When I move farther, it seems to disappear : Screenshot 02
I've checked a lot of post about terrain seam etc. but I couldn't find something to fix this problem. I've already disabled parallax to reduce the effect.
I thought it was the terrain skirt but after setting it to 0 nothing changed.
If I set the compositeMapDistance to 0 the seam is reduced but there is still something visible and the global image quality is reduced : Screenshot 03
Note that with a seamless texture it doesn't occur : Screenshot 04
But well I can't use a seamless texture in my case.. Also I'm sure my picture is correctly split.
Can anyone help me making my chunks fit perfectly together ?