Terrain Node problem!!!! :(

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Zharramadar
Posts: 11
Joined: Mon Sep 18, 2006 12:03 am

Terrain Node problem!!!! :(

Post by Zharramadar »

Hi ppl.

I'm trying to make terrain paging here, but I'm having trouble trying to put the edges right.

I made 2 terrain nodes, and loaded seamless heightmaps to them, and moved the 2nd node to the end of the 1st node bounding box, and okay, I got it right beside the 1st node...

But what I can't figure out is the scale of the object. I have 2 bitmaps, but I know in one you have a greater difference of height than in the other (as one is the valley of the other, which is te start of some mountains), and I cant make it fit.

Do you ppl have any way that I can make paging terrains? Or how I can find scaling and position values so my terrain node can attach perfectly to each other? :?
Zharramadar
Posts: 11
Joined: Mon Sep 18, 2006 12:03 am

Post by Zharramadar »

Very well, I found out my heightmap is not being completely rendered.

I inserted a white dot in the corners of the 2 heightmaps, and I saw that only one "single-dot hill" appeared, the one at the origin. I've played with the heightmaps and I discovered that 8 pixels in each side of my heightmap don't show up correctly. I'm using 256x256 heightmaps, but I also tried now with 257x257, 128x128 and 129x129 pixels heightmaps.... Don't seems to change.

I've played also with scene::E_TERRAIN_PATCH_SIZE, changing some parameters, and no results.

What i'm doing wrong that my heightmap don't show up completely????

I'm using terrain demo as a template to play up with terrains.

Any help?
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

unfortunatley the terrain example is not a very good example, since you have to use n^2 +1 sized textures if you want tiled terrains to line up. 257x257 is too large (more than 64k vertices). 129x129 should work okay though.. what's the problem with this size?
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Actually it's 2^n+1... ;)
But right, 257*257 should work...
But the terrain is not build correctly !!!
It's flipped and mirrored !!!
Maybe this is your problem ???
Try a blanc texture with some text written on and apply it to the terrain... ;)

I wrote how to correct this in the "Bug Reports" forum !!!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

oops 2^n+1.
I think that ":oops:" emoticon should be my new avatar!
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Zharramadar
Posts: 11
Joined: Mon Sep 18, 2006 12:03 am

Post by Zharramadar »

Well, i tried both 2^n and 2^n+1, as I posted above...

Anyway, I solved this problem, all the four corners appear correctly now.

The preoblem with the 129x129 is that it's a too small heightmap, it lacks detail.... Or I stretch a 129x129 heightmap in a large surface or I make annoying LOADS of tiled terrain to achieve a decent size with decent detail...

Even 257x257 is few detail, but at least it is a better number.

Although I don't know why no one bothered to allow greater than 256x256 heightmaps yet, changing the indices....

and, Acki, I used your code in your "bug report" post, and I got some compile errors..... Even when I use your app to change Irrlicht....
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

for the 2^n+1: if you use 2^n (what's normal for textures) the terrain will be 16 square cut in both directions...

The terrain must be a square of (2^x+1)*(2^x+1), double x is no error y is ignored and set to x !!!

You can also try to set the maxLOD to 1 when creating the terrain...

well, for the bug: what did you do ???
what compiler errors ???
what errors with IrrExtensions ???
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Zharramadar
Posts: 11
Joined: Mon Sep 18, 2006 12:03 am

Post by Zharramadar »

When I applied your IrrExtensions, using only Dx9 and OpenGL, and setting only the TerrainSceneManager option, the error I have with VC++ 2005 is:

Code: Select all

1>CSceneManager.cpp
1>.\CSceneManager.cpp(564) : error C2259: 'irr::scene::CTerrainSceneNode' : cannot instantiate abstract class
1>        due to following members:
1>        'void irr::scene::ITerrainSceneNode::setPivot(irr::scene::posPivot)' : is abstract
1>        ..\..\include\ITerrainSceneNode.h(84) : see declaration of 'irr::scene::ITerrainSceneNode::setPivot'
1>.\CSceneManager.cpp(1171) : error C2259: 'irr::scene::CSceneManager' : cannot instantiate abstract class
1>        due to following members:
1>        'irr::scene::ITerrainSceneNode *irr::scene::ISceneManager::addTerrainSceneNode2(irr::io::IReadFile *,irr::scene::ISceneNode *,irr::s32,const irr::core::vector3df &,const irr::core::vector3df &,const irr::core::vector3df &,irr::video::SColor,irr::s32,irr::scene::E_TERRAIN_PATCH_SIZE)' : is abstract
1>        ..\..\include\ISceneManager.h(282) : see declaration of 'irr::scene::ISceneManager::addTerrainSceneNode2'
1>        'irr::scene::ITerrainSceneNode *irr::scene::ISceneManager::addTerrainSceneNode2(const char *,irr::scene::ISceneNode *,irr::s32,const irr::core::vector3df &,const irr::core::vector3df &,const irr::core::vector3df &,irr::video::SColor,irr::s32,irr::scene::E_TERRAIN_PATCH_SIZE)' : is abstract
1>        ..\..\include\ISceneManager.h(278) : see declaration of 'irr::scene::ISceneManager::addTerrainSceneNode2'
1>.\CSceneManager.cpp(1664) : error C2259: 'irr::scene::CSceneManager' : cannot instantiate abstract class
1>        due to following members:
1>        'irr::scene::ITerrainSceneNode *irr::scene::ISceneManager::addTerrainSceneNode2(irr::io::IReadFile *,irr::scene::ISceneNode *,irr::s32,const irr::core::vector3df &,const irr::core::vector3df &,const irr::core::vector3df &,irr::video::SColor,irr::s32,irr::scene::E_TERRAIN_PATCH_SIZE)' : is abstract
1>        ..\..\include\ISceneManager.h(282) : see declaration of 'irr::scene::ISceneManager::addTerrainSceneNode2'
1>        'irr::scene::ITerrainSceneNode *irr::scene::ISceneManager::addTerrainSceneNode2(const char *,irr::scene::ISceneNode *,irr::s32,const irr::core::vector3df &,const irr::core::vector3df &,const irr::core::vector3df &,irr::video::SColor,irr::s32,irr::scene::E_TERRAIN_PATCH_SIZE)' : is abstract
1>        ..\..\include\ISceneManager.h(278) : see declaration of 'irr::scene::ISceneManager::addTerrainSceneNode2'
I'll try with the maxLod = 1 :)
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Ahhh, you're using the VC project !!! ;)
Sorry, if you read the FAQs on my site, you'll see I can't test this project file...

But as I can see, the wrong include path is choosen !!!
It should be ".\include\*" and not "..\..\include\*" !!!

Did you make a copy of the include folder inside the source folder ???
Did you use the correct project file ???
There are 3 VC project files, but only one is correct !!!
Be sure to use the "Irrlicht.dsp" project !!!
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Zharramadar
Posts: 11
Joined: Mon Sep 18, 2006 12:03 am

Post by Zharramadar »

Well,

I tried to open Irrlicht.dsp now, and Visual Studio .NET 2005 wanted to convert it to a new solution, refusing to open the dsp as it is.

When I compiled it, I got the same errors as before.

I tried with all project files (.sln, .dsp, .dsw) even knowing they would probably do the same, which they did.

I really can't compile it when I apply your app to it :(
Aleyer
Posts: 17
Joined: Thu Dec 14, 2006 9:03 pm

Post by Aleyer »

I have exactly the same problem. I cut the 903x903 pixels terrain into 129x129 pieces, created a tile heighmap using

Code: Select all

for (v=1;v<=7;v++)
{
	for (u=1;u<=7;u++)
{	
str1="D:/3D/2008/DATA/heightmap/h";
str1+=v;
str1+=u;
str1+=".bmp";
	scene::ITerrainSceneNode* terraiin = smgr->addTerrainSceneNode( 
		str1.c_str(),
		0,										// parent node
		-1,										// node id
		core::vector3df(1280.f*(u-1), 0.f, 1280.f*(v-1)),			// position
		core::vector3df(0.f, 0.f, 0.f),			// rotation
		core::vector3df(10.f, 1.f, 10.f),		// scale
		video::SColor ( 255, 255, 255, 255 ),	// vertexColor,
		5,										// maxLOD
		scene::ETPS_17,							// patchSize
		4										// smoothFactor
		);

	terraiin->setMaterialFlag(video::EMF_LIGHTING, false);
str1="D:/3D/2008/DATA/heightmap/t";
str1+=v;
str1+=u;
str1+=".bmp";
	terraiin->setMaterialTexture(0, driver->getTexture(str1.c_str()));
	terraiin->setMaterialTexture(1, driver->getTexture("D:/3D/2008/DATA/snou.bmp"));
	
	terraiin->setMaterialType(video::EMT_DETAIL_MAP);

	terraiin->scaleTexture(1.0f, 250.0f);


}
}
But still there are problems on the seams:
Image
What should I do to resolve the problem?
Aleyer
Posts: 17
Joined: Thu Dec 14, 2006 9:03 pm

Post by Aleyer »

Well, it was rather easy.
I created a 1025x1025 heightmap, devided it into 64 129x129 tiles so that the next tile contains the last row of pixels of the previous one. Then I created the terrain and exported it into irredit. in it I switch texture wrap to clamp without repeat and everything looks seamless, except for from long distances.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, that sounds reasonable :) The probelm with far distances could be in LOD precision, or due to LOD steps. Maybe make some screenshots and a report in the bug forum.
Frosty Topaz
Posts: 107
Joined: Sat Nov 04, 2006 9:42 pm

Post by Frosty Topaz »

You also need to watch what you put for the smoothing value. I've found that smoothing the terrain sometimes moves the edges so that they wont match no matter what you try.

Alternately arras wrote a fast seamless tiled terrain scene node. Do a quick search through the forums and I'm sure you can find it.
Frosty Topaz
=========
It isn't easy being ice-encrusted aluminum silicate fluoride hydroxide...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Yes, but I think that smoothing the borders could be thought of as a bug. At least those vertices should not move (and it wouldn't help in smoothing anyway).
Post Reply