Page 25 of 28
Re: New Terrain Early Shots
Posted: Fri Apr 23, 2010 5:09 pm
by sinbad
This is normally an issue with the pass hash changing at the wrong time - what we do when the pass hash changes is put it on a list for re-adding (see Pass::_dirtyHash), because the getHash() value will be inconsistent with the value used to insert it in the std::map if we just change it immediately without removing & re-adding it. This suggests that something is short-circuiting that, updating the hash too early or something. It may be where you're altering the material? And you're not calling _recalculateHash() yourself are you?
Re: New Terrain Early Shots
Posted: Fri Apr 23, 2010 5:51 pm
by stealth977
nope its the first time i hear recalculateHash
my order is in framestarted
addLayer()
getMaterial()
addnewdecalpass()
getBlendPointer()
modify()
blendmap->update()
terraingroup->update()
no exceptions till here
then rendering starts and i get the exception, if tergroup->update() is not called there is no problem (and so i removed it)
Re: New Terrain Early Shots
Posted: Sun Apr 25, 2010 6:24 pm
by Xplodwild
Did you plan something to hide or show certain tiles ? To create caves for example
Re: New Terrain Early Shots
Posted: Mon Apr 26, 2010 11:58 am
by sinbad
Xplodwild wrote:Did you plan something to hide or show certain tiles ? To create caves for example
This is better done via stencilling techniques.
Re: New Terrain Early Shots
Posted: Mon Apr 26, 2010 10:40 pm
by zhell
Hi, after some hours, i still can't figure out how to use the terrain paging system with raws.
i want my raws to be loaded and saved as .dat files while the player is travelling through the map.
could you indicate me a way of achieving this ?
thanks.
ps: i was unable to find in the terrain plugin (in OgreSrc) where the .dat is loaded
Re: New Terrain Early Shots
Posted: Tue Apr 27, 2010 5:35 pm
by sinbad
Everything is in Components/Terrain. The terrain saving / loading is in Terrain::save and Terrain::prepare (everything is done via StreamSerializer).
To import RAW, you simply need to read the RAW file into memory (assuming it's just a buffer of floats) and give the pointer to ImportData::inputFloat. If your RAW format is not an array of floats you'll have to convert it to such yourself first.
Regardless of what format you imported the data from, Terrain::save will save it as our .dat format.
Re: New Terrain Early Shots
Posted: Wed Apr 28, 2010 4:01 pm
by simply
The skirts are shining through my terrain. Anybody has an idea what's it causing or what I am doing wrong? I'm using SDK 1.7.1.
It's on a Radeon Mobile 3460 while using the DX9 Render System.

Re: New Terrain Early Shots
Posted: Thu Apr 29, 2010 10:43 am
by sinbad
Are you customising the material? Looks like you're doing a pass with a different depth check / write / bias setting.
Re: New Terrain Early Shots
Posted: Thu Apr 29, 2010 8:56 pm
by simply
No, I don't. All I do is setting the textures via ImportSettings and load a png heightmap with defineTerrain.
I had the same error when I was using the terrain .dat files from Ogitor, whereas I don't have this error in Ogitor with the same terrain displayed.
Re: New Terrain Early Shots
Posted: Thu Apr 29, 2010 9:09 pm
by jacmoe
What kind of textures are you using?
How are you defining the layers?
Re: New Terrain Early Shots
Posted: Thu Apr 29, 2010 9:12 pm
by simply
jacmoe wrote:What kind of textures are you using?
I've stolen them from deep within Ogitor's program directory.
jacmoe wrote:How are you defining the layers?
Just like in the terrain sample.
Re: New Terrain Early Shots
Posted: Fri Apr 30, 2010 9:43 am
by sinbad
Does the terrain sample do it too? If so, it might be a driver thing, if not, it's definitely a difference in your app.
Re: New Terrain Early Shots
Posted: Sat May 01, 2010 2:41 pm
by zhell
hi again,
while i was working with the new terrain, i realized that i were unable to load, unload, and reload a terrain, like the "hold" of the paging system.
here is my attempt, the code is placed in the frameRenderingQueued() of the demoterrain:
Code: Select all
count = count+1;
if(count == 1)
{
Image img;
img.load("terrain.png", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mTerrainGroup->defineTerrain(0, 0, &img);
mTerrainGroup->loadTerrain(0, 0);
LogManager::getSingleton().getLog("ogre.log")->logMessage(" load ");
}
if(count == 100)
{
mTerrainGroup->getTerrain(0,0)->unload();
LogManager::getSingleton().getLog("ogre.log")->logMessage(" unload ");
}
if(count == 300)
{
LogManager::getSingleton().getLog("ogre.log")->logMessage("reload");
mTerrainGroup->loadTerrain(0, 0);
//LogManager::getSingleton().getLog("ogre.log")->logMessage("count. "+Ogre::StringConverter::toString(count));
}
everything is fine in the ogre.log, but as far as the render is concerned : i see the terrain load, unload, ... and never reload.
i am wondering if the terrain definition is destroyed with the unloading ?
what is the right way of "holding" a terrain already loaded without displaying it ?
Re: New Terrain Early Shots
Posted: Sat May 01, 2010 3:17 pm
by stealth977
you probably should call mTerrainGroup->unloadTerrain(); (or whatever function), directly unloading from the terrain's handle may confuse the terraingroup.
Re: New Terrain Early Shots
Posted: Sat May 01, 2010 3:31 pm
by zhell
thank you, though even with mTerrainGroup->unloadTerrain(0, 0);, the terrain is still not re-loading.
Re: New Terrain Early Shots
Posted: Sat May 01, 2010 3:35 pm
by stealth977
Code: Select all
if(count == 1)
{
Image img;
img.load("terrain.png", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mTerrainGroup->defineTerrain(0, 0, &img);
mTerrainGroup->loadTerrain(0, 0);
LogManager::getSingleton().getLog("ogre.log")->logMessage(" load ");
}
can it be because Image is being destroyed when it gets out of scope after "}" so your next load call accesses a destroyed image?
Re: New Terrain Early Shots
Posted: Sat May 01, 2010 3:52 pm
by zhell
i tried to create the img as a protected, and load it during the setupContent(), with no more results :/
Re: New Terrain Early Shots
Posted: Sun May 02, 2010 8:23 am
by Xplodwild
sinbad wrote:Xplodwild wrote:Did you plan something to hide or show certain tiles ? To create caves for example
This is better done via stencilling techniques.
Can you elaborate a bit on it ?
Re: New Terrain Early Shots
Posted: Sun May 02, 2010 12:51 pm
by Fish
Xplodwild wrote:sinbad wrote:Xplodwild wrote:Did you plan something to hide or show certain tiles ? To create caves for example
This is better done via stencilling techniques.
Can you elaborate a bit on it ?
http://www.ogre3d.org/forums/viewtopic. ... 02#p368202
Re: New Terrain Early Shots
Posted: Sun May 02, 2010 2:08 pm
by Xplodwild
Thanks Fish, but I'm still really lost on how to do it :s Any advice, code speaking ?
Re: New Terrain Early Shots
Posted: Wed May 05, 2010 1:12 pm
by stealth977
@Sinbad:
I found a small limited range bug in DefaultMaterialGenerator:
Code: Select all
void TerrainMaterialGeneratorA::SM2Profile::addTechnique(
const MaterialPtr& mat, const Terrain* terrain, TechniqueType tt)
{
..........................
...........................
// light map
if (isLightmapEnabled())
{
BELOW, THERE IS NO CHECK IF LIGHTMAP IS NULL!!! LIGHTMAP NEEDS TO BE CHECKED AND RE-CREATED IF NULL
tu = pass->createTextureUnitState(terrain->getLightmap()->getName());
tu->setTextureAddressingMode(TextureUnitState::TAM_CLAMP);
}
If you disable the lightmaps from Profile before you load the terrain (to speed up new terrain generation process since lets say importing 9 terrains costs around 10 minutes when lightmap is created) and re-activate them after the terrains are created, you get a crash because of the MARKED LINE ABOVE...
This may also apply to Colourmap and anywhere else they are being used...
Re: New Terrain Early Shots
Posted: Sat May 22, 2010 4:39 pm
by Retrofasciata
Don't know if this is (too much) off topic:
But is it possible to determine the center value of the height-maps?
Determining the Gamma value, would make it easier to make more detail at the heigher or lower values, since the density of data grows or shrinks accordingly the gamma setting.
Basically what you get is this:
Where black == 0 white == 100
grey == 50 can be set to higher or lower value
So you get this:
black==0 || 0 meter
grey==50 || 750 meter
white==0 || 1000 meter
Is this possible, or setting a bezier curve, so the histogram curve can be influenced to have more or less data at the lower, higher or center?
Beside this, is it possible to determine the border values of black and / or white?
By setting a lower limit, black, then i.e. under water there is no detail, but the water is deeper.
I can post some images to explain my question, but I hope it is clear this way.
Thanks, kind regards!
Re: New Terrain Early Shots
Posted: Mon May 24, 2010 4:52 pm
by sinbad
@stealth977: I believe this comes down to making the material generate re-request options from the terrain when the material settings are dirty, which wasn't happening before. The fix is, I think:
Code: Select all
diff --git a/Components/Terrain/src/OgreTerrain.cpp b/Components/Terrain/src/OgreTerrain.cpp
--- a/Components/Terrain/src/OgreTerrain.cpp
+++ b/Components/Terrain/src/OgreTerrain.cpp
@@ -2334,6 +2334,9 @@
mMaterialGenerator->getChangeCount() != mMaterialGenerationCount ||
mMaterialDirty)
{
+ // Regenerate options if needed (nasty const-cast I know, but you can't have mutable self)
+ mMaterialGenerator->requestOptions(const_cast<Terrain*>(this));
+
mMaterial = mMaterialGenerator->generate(this);
mMaterial->load();
if (mCompositeMapRequired)
I'm committing this anyway, hopefully that works for you. It should resolve the issue with any of the maps, not just the lightmap.
@Retrofasciata: You're coming at this from the wrong direction - if you need this much control over the conversion from image to height value, then simply pre-process the data yourself converting the Image into a float array and pass that to Terrain instead. There's no point us trying to provide every possible conversion curve or precision adjustment approach - the Image converter that is there is a convenience, and nothing more. The 'real' input to the terrain is in the form of a float array, and that's what you should use if you have anything other than trivial requirements.
Re: New Terrain Early Shots
Posted: Mon May 24, 2010 6:45 pm
by Retrofasciata
roger, thnx

Re: New Terrain Early Shots
Posted: Mon May 31, 2010 12:42 pm
by vodkabears
I'm sorry but where can i find some kind of tutorials to show how to use this terrain in my app?
And one more question, i'm using BasicOgreFramework from wiki and there is no FrameListener in it, should i add it to use this terrain?
sorry about my english