Terrain composite map wrong after loading terrain from file

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
moagames
Halfling
Posts: 70
Joined: Thu Apr 10, 2008 8:10 pm

Terrain composite map wrong after loading terrain from file

Post by moagames » Wed Feb 09, 2011 9:00 pm

Hi,


It seems, that there is a bug in the new terrain system if you follow these steps:
1. initialize a flat terrain using the code below (the same as in the terrain demo)
2. edit the blend maps,
3. save the terrain
4. restart the application (now you have again a fresh version of the terrain)
5. load the saved terrain
6. edit the blendmaps or the heights of the saved terrain

result:
the composite map of the terrain isn't edited to the new value, but instead, the updated rectangle of the composite map just shows the composite map of the terrain BEFORE loading.

The problem is demonstrated in this video:
[youtube]5Qjl8tdgsHs[/youtube]


And here is the code:

I initialize the terrain this way:

Code: Select all

mTerrainGlobals = OGRE_NEW TerrainGlobalOptions();

mTerrainGroup = OGRE_NEW TerrainGroup(m_SceneManager, Terrain::ALIGN_X_Z, 2048, 4096);
mTerrainGroup->setOrigin(Vector3(2048, 0, 2048));

// Configure global
mTerrainGlobals->setMaxPixelError(8);
// set the material generator
mTerrainGlobals->setDefaultMaterialGenerator(TerrainMaterialGeneratorPtr(OGRE_NEW TerrainMaterialGeneratorB()));
// testing composite map
mTerrainGlobals->setCompositeMapDistance(100);
mTerrainGlobals->setCompositeMapSize(2048);

//mTerrainGlobals->setCompositeMapAmbient(ColourValue::Red);
mTerrainGlobals->setLayerBlendMapSize(2048);

// Configure default import settings for if we use imported image
Terrain::ImportData& defaultimp = mTerrainGroup->getDefaultImportSettings();
defaultimp.terrainSize = 2048;
defaultimp.worldSize = 4096;
defaultimp.inputScale = 300;
defaultimp.minBatchSize = 33;
defaultimp.maxBatchSize = 65;
// textures
m_iNumTerrainBlendLayers = 3;
defaultimp.layerList.resize(3);
defaultimp.layerList[0].worldSize = 3;
defaultimp.layerList[0].textureNames.push_back("growth_weirdfungus-03_diffusespecular.dds");
defaultimp.layerList[0].textureNames.push_back("growth_weirdfungus-03_normalheight.dds");
defaultimp.layerList[1].worldSize = 5;
defaultimp.layerList[1].textureNames.push_back("grass_green-01_diffusespecular.dds");
defaultimp.layerList[1].textureNames.push_back("grass_green-01_normalheight.dds");
defaultimp.layerList[2].worldSize = 5;
defaultimp.layerList[2].textureNames.push_back("splatting2.dds");
defaultimp.layerList[2].textureNames.push_back("splatting2_norm.dds");

mTerrainGroup->defineTerrain(0, 0, 0.0f);
mTerrainGroup->loadAllTerrains(true);

mTerrainGroup->freeTemporaryResources();
Code for saving the terrain:

Code: Select all

mTerrainGroup->getTerrain(0, 0)->save(path+"\\Terrain.ter");
loading the terrain:

Code: Select all

mTerrainGroup->removeAllTerrains();
	mTerrainGroup->defineTerrain(0, 0, path+"\\Terrain.ter");
	mTerrainGroup->loadAllTerrains(true);
Did someone else face this error ?
Or even better, does anyone know a solution for this ?

THX
0 x

moagames
Halfling
Posts: 70
Joined: Thu Apr 10, 2008 8:10 pm

Re: Terrain composite map wrong after loading terrain from f

Post by moagames » Tue Feb 15, 2011 12:13 pm

no one else has seen this error ?
Or does just nobody use the new terrain system with save / load functionality in combination of composite maps ?
0 x

Post Reply