New Terrain Early Shots
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
Re: New Terrain Early Shots
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?
-
- Gnoll
- Posts: 638
- Joined: Mon Dec 15, 2008 6:14 pm
- Location: Istanbul, Turkey
- x 42
Re: New Terrain Early Shots
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)

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)
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
-
- Goblin
- Posts: 231
- Joined: Thu Feb 12, 2009 3:49 pm
- Location: France
- x 13
Re: New Terrain Early Shots
Did you plan something to hide or show certain tiles ? To create caves for example
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
Re: New Terrain Early Shots
This is better done via stencilling techniques.Xplodwild wrote:Did you plan something to hide or show certain tiles ? To create caves for example
-
- Halfling
- Posts: 45
- Joined: Mon Jul 23, 2007 8:01 pm
- Location: france
Re: New Terrain Early Shots
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
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
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
Re: New Terrain Early Shots
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.
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.
-
- Halfling
- Posts: 45
- Joined: Mon Jun 12, 2006 10:45 am
- Location: Switzerland
Re: New Terrain Early Shots
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.

It's on a Radeon Mobile 3460 while using the DX9 Render System.

-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
Re: New Terrain Early Shots
Are you customising the material? Looks like you're doing a pass with a different depth check / write / bias setting.
-
- Halfling
- Posts: 45
- Joined: Mon Jun 12, 2006 10:45 am
- Location: Switzerland
Re: New Terrain Early Shots
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.
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.
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
Re: New Terrain Early Shots
What kind of textures are you using?
How are you defining the layers?
How are you defining the layers?
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Halfling
- Posts: 45
- Joined: Mon Jun 12, 2006 10:45 am
- Location: Switzerland
Re: New Terrain Early Shots
I've stolen them from deep within Ogitor's program directory.jacmoe wrote:What kind of textures are you using?

Just like in the terrain sample.jacmoe wrote:How are you defining the layers?
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
Re: New Terrain Early Shots
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.
-
- Halfling
- Posts: 45
- Joined: Mon Jul 23, 2007 8:01 pm
- Location: france
Re: New Terrain Early Shots
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:
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 ?
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));
}
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 ?
-
- Gnoll
- Posts: 638
- Joined: Mon Dec 15, 2008 6:14 pm
- Location: Istanbul, Turkey
- x 42
Re: New Terrain Early Shots
you probably should call mTerrainGroup->unloadTerrain(); (or whatever function), directly unloading from the terrain's handle may confuse the terraingroup.
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
-
- Halfling
- Posts: 45
- Joined: Mon Jul 23, 2007 8:01 pm
- Location: france
Re: New Terrain Early Shots
thank you, though even with mTerrainGroup->unloadTerrain(0, 0);, the terrain is still not re-loading.
-
- Gnoll
- Posts: 638
- Joined: Mon Dec 15, 2008 6:14 pm
- Location: Istanbul, Turkey
- x 42
Re: New Terrain Early Shots
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 ");
}
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
-
- Halfling
- Posts: 45
- Joined: Mon Jul 23, 2007 8:01 pm
- Location: france
Re: New Terrain Early Shots
i tried to create the img as a protected, and load it during the setupContent(), with no more results :/
-
- Goblin
- Posts: 231
- Joined: Thu Feb 12, 2009 3:49 pm
- Location: France
- x 13
Re: New Terrain Early Shots
Can you elaborate a bit on it ?sinbad wrote:This is better done via stencilling techniques.Xplodwild wrote:Did you plan something to hide or show certain tiles ? To create caves for example
-
- Greenskin
- Posts: 131
- Joined: Fri Aug 22, 2008 6:12 pm
Re: New Terrain Early Shots
http://www.ogre3d.org/forums/viewtopic. ... 02#p368202Xplodwild wrote:Can you elaborate a bit on it ?sinbad wrote:This is better done via stencilling techniques.Xplodwild wrote:Did you plan something to hide or show certain tiles ? To create caves for example
-
- Goblin
- Posts: 231
- Joined: Thu Feb 12, 2009 3:49 pm
- Location: France
- x 13
Re: New Terrain Early Shots
Thanks Fish, but I'm still really lost on how to do it :s Any advice, code speaking ?
-
- Gnoll
- Posts: 638
- Joined: Mon Dec 15, 2008 6:14 pm
- Location: Istanbul, Turkey
- x 42
Re: New Terrain Early Shots
@Sinbad:
I found a small limited range bug in DefaultMaterialGenerator:
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...
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);
}
This may also apply to Colourmap and anywhere else they are being used...
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
Re: New Terrain Early Shots
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!
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!
Last edited by Retrofasciata on Mon May 24, 2010 6:46 pm, edited 2 times in total.
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
Re: New Terrain Early Shots
@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:
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.
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)
@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.
-
- Gnoblar
- Posts: 3
- Joined: Mon May 31, 2010 12:16 pm
Re: New Terrain Early Shots
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
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