New Terrain Early Shots

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
spong3bob
Gnoblar
Posts: 5
Joined: Tue Jun 16, 2009 7:42 pm

Re: New Terrain Early Shots

Post by spong3bob »

I just wanted to try the demo, so i downloaded the source via the svn trunk.
then i used cmake to create the vc++ projekt and compiled it.. but when i want to compile the PlayPen i get an error saying it cant find the OgreTerrain.h file..

any idea what im doing wrong?
Zero
Halfling
Posts: 50
Joined: Mon Mar 10, 2008 12:08 am
Location: Stuttgart|Germany
x 1
Contact:

Re: New Terrain Early Shots

Post by Zero »

First, nice work sinbad :D

@spong3bob:
I had the same bug... so I used for the include the absolute path to the file or you only specify the include dir :D
Image
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: New Terrain Early Shots

Post by KungFooMasta »

Thanks for clarifying stealth and Sinbad. I agree catering to all edge cases would be a misuse of your time. Was just wondering how feasible it for that feature to work, apparently its not very feasible. :lol: I'll probably be asking more questions as I start using the Terrain, maybe it will help generate good ideas, or at least I'll gain more understanding of the design. (and hopefully other people will too)
Creator of QuickGUI!
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: New Terrain Early Shots

Post by KungFooMasta »

I'm following the PlayPen example, but not being successful in getting any Terrain to show up. Here is the code I added into my app:

Code: Select all

		Ogre::MaterialManager::getSingleton().setDefaultTextureFiltering(Ogre::TFO_ANISOTROPIC);
		Ogre::MaterialManager::getSingleton().setDefaultAnisotropy(7);

		Ogre::LogManager::getSingleton().setLogDetail(Ogre::LL_BOREME);

		// Until material implemented
		Ogre::TerrainGlobalOptions::setMaxPixelError(8);
		//TerrainGlobalOptions::setUseRayBoxDistanceCalculation(true);

		Ogre::Light* l = mScene->_getOgreSceneManager()->createLight("tstLight");
		l->setType(Ogre::Light::LT_DIRECTIONAL);
		Ogre::Vector3 dir(0.55, -0.5, 0.75);
		dir.normalise();
		l->setDirection(dir);
		l->setDiffuseColour(Ogre::ColourValue::White);
		l->setSpecularColour(Ogre::ColourValue(0.4, 0.4, 0.4));

		mScene->_getOgreSceneManager()->setAmbientLight(Ogre::ColourValue(0.2, 0.2, 0.2));

		mOgreTerrain = OGRE_NEW Ogre::Terrain(mScene->_getOgreSceneManager());

		Ogre::Image img;
		img.load("terrain.png", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
		//img.load("terrain_flattened.png", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

		Ogre::Terrain::ImportData imp;
		imp.inputImage = &img;
		imp.terrainSize = 513;
		imp.worldSize = 8000;
		imp.inputScale = 600;
		imp.minBatchSize = 33;
		imp.maxBatchSize = 65;
		// textures
		imp.layerList.resize(2);
		imp.layerList[0].worldSize = 20;
		imp.layerList[0].textureNames.push_back("grass_green-01_diffusespecular.dds");
		imp.layerList[0].textureNames.push_back("grass_green-01_normalheight.dds");
		imp.layerList[1].worldSize = 100;
		imp.layerList[1].textureNames.push_back("dirt_grayrocky_diffusespecular.dds");
		imp.layerList[1].textureNames.push_back("dirt_grayrocky_normalheight.dds");
		mOgreTerrain->prepare(imp);
		mOgreTerrain->load();

		Ogre::TerrainLayerBlendMap* blendMap0 = mOgreTerrain->getLayerBlendMap(1);
		Ogre::Real rockMinHeight = 100;
		Ogre::Real rockFadeDist = 15;
		Ogre::uint8* pBlend = blendMap0->getBlendPointer();
		for (Ogre::uint16 y = 0; y < mOgreTerrain->getLayerBlendMapSize(); ++y)
		{
			for (Ogre::uint16 x = 0; x < mOgreTerrain->getLayerBlendMapSize(); ++x)
			{
				Ogre::Real tx, ty;

				blendMap0->convertImageToTerrainSpace(x, y, &tx, &ty);
				Ogre::Real height = mOgreTerrain->getHeightAtTerrainPosition(tx, ty);
				Ogre::Real val = (height - rockMinHeight) / rockFadeDist;
				val = Ogre::Math::Clamp(val, (Ogre::Real)0, (Ogre::Real)1);

				*pBlend++ = val * 255;

			}
		}
		blendMap0->dirty();
		blendMap0->update();
Screenshot:
Image

Also, what does the inputScale property do? The comments say "/// How to scale the input values provided (if any)", but I still don't understand. In the PlayPen, why is it set to 600? If it helps, my world scale is 1 Ogre unit = 1 meter.

[Edit] I have the textures in the same directory as my other textures, so if we see the tower, the terrain textures should all be accessible also. My video card is a Nvidia Geforce 7900 [/Edit]
Creator of QuickGUI!
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: New Terrain Early Shots

Post by jacmoe »

inputScale scales the heightmap data:

Code: Select all

				float* pAdj = mHeightData;
				for (size_t i = 0; i < numVertices; ++i)
				{
					*pAdj = (*pAdj * importData.inputScale) + importData.inputBias;	
					++pAdj;
				}
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: New Terrain Early Shots

Post by sinbad »

spong3bob wrote:I just wanted to try the demo, so i downloaded the source via the svn trunk.
then i used cmake to create the vc++ projekt and compiled it.. but when i want to compile the PlayPen i get an error saying it cant find the OgreTerrain.h file..

any idea what im doing wrong?
Probably means you didn't re-run CMake to pick up the terrain component paths.

@KungFooMasta: first of all, check the log, and make sure you're in a position to see the terrain. Also check PlayPen works on your machine first.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Re: New Terrain Early Shots

Post by Crashy »

Mmhhhhhh, it tastes good. Exactly what I was waiting for the new terrain engine.
Go on Sinbad, your doing it well :)
spong3bob
Gnoblar
Posts: 5
Joined: Tue Jun 16, 2009 7:42 pm

Re: New Terrain Early Shots

Post by spong3bob »

Zero wrote:First, nice work sinbad :D

@spong3bob:
I had the same bug... so I used for the include the absolute path to the file or you only specify the include dir :D
so i just tried that.. but now im getting some new errors (im just gonna post the first one as the rest is pretty similar)..

PlayPen.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) public: void __thiscall Ogre::TerrainLayerBlendMap::update(void)" (__imp_?update@TerrainLayerBlendMap@Ogre@@QAEXXZ)" in Funktion ""protected: void __thiscall PlayPenApplication::testNewTerrain(void)" (?testNewTerrain@PlayPenApplication@@IAEXXZ)".
Zero
Halfling
Posts: 50
Joined: Mon Mar 10, 2008 12:08 am
Location: Stuttgart|Germany
x 1
Contact:

Re: New Terrain Early Shots

Post by Zero »

You have to link the OgreTerrain.lib

Zero
Image
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: New Terrain Early Shots

Post by sinbad »

Zero wrote:You have to link the OgreTerrain.lib

Zero
Again, CMake handles all this if you're building PlayPen, provided you've run it with the latest options. Make sure the checkbox OGRE_BUILD_COMPONENT_TERRAIN is checked.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: New Terrain Early Shots

Post by syedhs »

I have also got the same errors (error including OgreTerrain.h) and also the line # 8254 where it reads mStaticPluginLoader.load(*mRoot);.

Of course I changed them so that it could compile and link, but probably it has to do with Ogre static linkage?
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: New Terrain Early Shots

Post by sinbad »

syedhs wrote:Of course I changed them so that it could compile and link, but probably it has to do with Ogre static linkage?
Possibly - I haven't tried with static linking yet.

This week is going to be mental for me so OgreTerrain is taking a bit of a back seat until I clear my backlog. Remember, everything here is 'early access' and not guaranteed to work yet :)
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: New Terrain Early Shots

Post by KungFooMasta »

Ok finally got around to trying out PlayPen, I should have tried it out first. The terrain loads and is visible, so I'll have to see how PlayPen differs from my own app.
Creator of QuickGUI!
User avatar
KungFooMasta
OGRE Contributor
OGRE Contributor
Posts: 2087
Joined: Thu Mar 03, 2005 7:11 am
Location: WA, USA
x 16
Contact:

Re: New Terrain Early Shots

Post by KungFooMasta »

Just to let everybody know the terrain was always rendering in my own app, but its so dang massive (I just c/p from PlayPen :mrgreen: ), my tower was at 0,0,0, the terrain center was at 0,0,0, but the tower ends up being a couple hundred units under the terrain. :lol: Looking forward to playing with the terrain more! :D
Creator of QuickGUI!
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Re: New Terrain Early Shots

Post by Kencho »

Don't you just hate when that happens? It's like an uninitialised pointer in 3D space :lol:
Image
User avatar
stealth977
Gnoll
Posts: 638
Joined: Mon Dec 15, 2008 6:14 pm
Location: Istanbul, Turkey
x 42

Re: New Terrain Early Shots

Post by stealth977 »

Below is a screenshot of Splatting Test for Ogre::Terrain in Ogitor:
editing_blend.png
editing_blend.png (176.43 KiB) Viewed 5330 times
NOTE: The blue thingy is the decal cursor showing the brush

ismail,
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: New Terrain Early Shots

Post by jacmoe »

Looks great, Stealth! :D

(Apart from that ugly MFC interface. :P
Still fixing build issues, but I am looking forward to seeing it in action in wxOgitor).
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: New Terrain Early Shots

Post by xadhoom »

Same from me :wink:

Looks very promising!
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: New Terrain Early Shots

Post by jacmoe »

jacmoe wrote:I am looking forward to seeing it in action in wxOgitor).
I just did - man, it's HUGE! :shock:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
stealth977
Gnoll
Posts: 638
Joined: Mon Dec 15, 2008 6:14 pm
Location: Istanbul, Turkey
x 42

Re: New Terrain Early Shots

Post by stealth977 »

Time to share some of my experience with Ogre::Terrain :

Pros
- It is possible to have multiple instances of the terrain to create irregular shaped terrains
- It is possible to have different sets of textures for each terrain instance
- It is possible to have different texture scales per layer
- Since the first layer is always visible when there is no other layer covering it, it is possible to use the first layer as BASE TEXTURE LAYER and insert a global map there, then paint on it using other layers, so that for distant lands, only layer 0 can be used for material lod
- there is no need for adjusting blend values of layers below when a new layer is added, all layers have a contribution of range 0..255 and gets nicely blended
- BlendMap updates are real fast
- You can retrieve the material and add a decal pass easily, the material is only regenerated during some important changes which is under your control

Temporary Cons:
- The Geometry update doesnt work at the moment, so you cant deform it (YET)
- On my machine, i get a device lost during terrain initialisation, so be sure to have manual loaders for your manual textures or they wont show up

Some more notes:
- The terrain height data is kept as floating point values. Although you can manually load from an image file, the InputScale and InputBias values are not kept by Ogre::Terrain, also there is no guard against a minimum or maximum height, so using PNG files for saving the terrain is not a good option. The best way would be saving it as float array during editing and converting to PNG + InputScale + InputBias values when exporting... (a Single PNG file will not be sufficient, need to save some kind of InputScale and InputBias)

Thats all i have on my mind now,

ismail,
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Re: New Terrain Early Shots

Post by Praetor »

Isn't saving to a StreamSerialiser the point? Instead of saving the terrain you made to an image + some settings? Does the stream that is saved out save everything, like the settings, maps, and height data? If so then I'd that is the way to go for saving from an editor.
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
User avatar
stealth977
Gnoll
Posts: 638
Joined: Mon Dec 15, 2008 6:14 pm
Location: Istanbul, Turkey
x 42

Re: New Terrain Early Shots

Post by stealth977 »

@Praetor:

Yes you are right, there is a StreamSerializer interface of Ogre::Terrain, but,
1 - Sinbad is using manual loading in PlayPen, so i didnt try using it, since it may be incomplete
2 - I am not sure how it behaves when the terrain is not loaded (in editor some areas may be offline (paging), but editor still needs to operate and supply the user required data as properties)
3 - Users generally like the components to be reachable by other programs (while using editor), such as the blendmap and heightmap data, that is why i save the blendmaps as L8 PNG and heightmap as float array, so they can be edited/tweaked in other programs as well, something that you cant do with the packed (StreamSerializer) version
4 - Of course when editing is done, the data can be exported as a native StreamSerializer version for easy asset management and faster loading...

ismail,

EDIT:
There is also a slight problem with parallax mapping which Xadhoom also detected, especially where two or more layers are blended, the normal/parallax mapping causes an illusion much like looking at a 3D picture on a screen with Red/Green goggles, the layers seem to MOVE over each other...
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
x 3
Contact:

Re: New Terrain Early Shots

Post by Praetor »

Well if the goal is accessibility for the height data then I can't see how you could beat a png image. Yes you will lose the absolute heights, but you could save those in a companion .dat file, since you are probably storing other settings anyway. Though, perhaps it isn't all that hard to make raw and png export options available.
Game Development, Engine Development, Porting
http://www.darkwindmedia.com
User avatar
stealth977
Gnoll
Posts: 638
Joined: Mon Dec 15, 2008 6:14 pm
Location: Istanbul, Turkey
x 42

Re: New Terrain Early Shots

Post by stealth977 »

Praetor wrote:Well if the goal is accessibility for the height data then I can't see how you could beat a png image. Yes you will lose the absolute heights, but you could save those in a companion .dat file, since you are probably storing other settings anyway. Though, perhaps it isn't all that hard to make raw and png export options available.
Yup you are right, thats why i implemented it as raw float array, should be accessible by many other editing programs... (PNG is useless since the user also needs to know the InputBias and InputScale if he wants to use the PNG file as is in another editor, also it would be a very lossy conversion even when L16 is used)

ismail,
Ismail TARIM
Ogitor - Ogre Scene Editor
WWW:http://www.ogitor.org
Repository: https://bitbucket.org/ogitor
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: New Terrain Early Shots

Post by sinbad »

stealth977 wrote: - The terrain height data is kept as floating point values. Although you can manually load from an image file, the InputScale and InputBias values are not kept by Ogre::Terrain, also there is no guard against a minimum or maximum height, so using PNG files for saving the terrain is not a good option. The best way would be saving it as float array during editing and converting to PNG + InputScale + InputBias values when exporting... (a Single PNG file will not be sufficient, need to save some kind of InputScale and InputBias)
stealth977 wrote:2 - I am not sure how it behaves when the terrain is not loaded (in editor some areas may be offline (paging), but editor still needs to operate and supply the user required data as properties)
3 - Users generally like the components to be reachable by other programs (while using editor), such as the blendmap and heightmap data, that is why i save the blendmaps as L8 PNG and heightmap as float array, so they can be edited/tweaked in other programs as well, something that you cant do with the packed (StreamSerializer) version
The reason I went for raw floats for the heights is that I didn't want to limit the core to a set precision (like 8- or 16-bit). This way, the min/max of the terrain is unbounded (well, within reason), meaning it's a lot more flexible - it can accurately represent terrains that would be impossible to store in even a 16-bit PNG without data loss. I allowed for importing from lower-precision sources but when saving, the full float data is the only lossless way - even exporting to 16-bit PNG will lose some precision. If people want to process the data in external tools then you can provide export functions in your editor, but you'd have to accept that precision loss unless you use a float format. I didn't include an export to PNG or similar because I didn't really want to encourage this, preferring to advocate a 1-way conversion from these 'lesser' formats.

I'm glad you've had some success in integrating the terrain into your editor. I will get to the outstanding issues as quickly as I can, but I have a lot of other work queued up this week and next which will mean the terrain is taking a temporary back seat.
Post Reply