New Tiled Terrain Scene Node [works with Irr 1.5]

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

For building mesh, I recommend you to look at IMeshBuffer, IMesh, SMeshBuffer and SMesh. Best if you look directly in to source files. Its not that difficult.

As for texture, my terrain use in fact only one texture, which is standard texture applied per tile and you can manipulate it on tile as you want. My terrain lets you access UV coordinates of tile directly so you can do anything you want with it. You can easily distribute one texture over several tiles.

Beside texture, each tile have its color ...you can "colorize" tiles with loadColorMap() or simply setColor() functions. Color of tile alter slightly color of texture as is applied over tile. So different tiles with same texture can look slightly different.

To understand hove this work, simply create simple flat terrain, apply texture to it and than change color of one of the tiles.
Vsk
Posts: 343
Joined: Thu Sep 27, 2007 4:43 pm

Post by Vsk »

Thanks for your patience :D .
But sorry... I still don't get a thing:

If I have texture with hight detail of road (or street) that I want put between tiles 20.20 and 500,500.

How do I loaded it and.. how I set (fot THIS texture) his tile coords?

The same question that if I have a texture that wants to repeat (for example) 10 times insde a tile, how do I do it?.

You named uv coords and that "I can do whatever I want" but you are talking about only the "detail texture" that you add with terrain->setMaterailTExture(0,"textura") right?

Is ist to hard to implement that I can load several textures and put it (forget about blending for now) in the tiles I want?
For example, load a text1 for entire terrain.
load text2 for a street that goes for tile 20,20 to 500,550
load text3 for a rock part betweent tiles 800,800 to 1000,100...
etc.

Any ideas to beggin to implement this, should I have an array of textures or something like that?

Thanks again, this is the last one! :lol:
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Well no unfortunately my node is not capable of displaying more than one texture and texture blending. This would require knoweledge of shaders and OpenGL-DirectX stuff which I do not have. I did start to learn it but gave it up. Basically it would require coding new material.

But elvman was extending my node with similar capability. You may look at his work:
http://irrlicht.sourceforge.net/phpBB2/ ... edeca7cf11
http://irrlicht.sourceforge.net/phpBB2/ ... edeca7cf11

While using only one texture my node gives you free hand over UV coordinates of each tile. This means you can put main texture from different one. Than you can apply for example sand texture over one tile, grass texture over second and rock over third. One problem is that you have to provide pregenerated transition textures as well in order that one material goes smoothly in to second. Second problem which was just discussed here is that mipmaping can generate ugly seams whit such texture. Look at posts above for description of this problem and hove it can be solved.

In my demo, texture used is in fact not just one texture, it consist of 4 different tiles which are randomly spread over terrain. Cut dirt_x_43.bmp in to half diagonally and vertically and you get 4 interchangeable textures.

When you load texture default UV coordinates of tile are set in such a way, that whole texture is applied over each tile. If you want to change them you can use setTileUV() function which lets you define UV coordinates of all 4 tile vertices. This way you can force tile to repeat whole texture 10 times across and 5 times over or let it display only small piece of texture or stretch texture over 5 tiles. Anything you want.

For detailed list and description of all functions you should look in to ShTlTerrainSceneNode.h its pretty well commented.
doraemonalex
Posts: 4
Joined: Sun Jan 20, 2008 7:37 am

Post by doraemonalex »

Hi I am a newbie to irrlicht and would like to add a movable player to the terrain.

Just now when I re-compile the terrain for first time without any modification, it is successful, but however it moves very lag and the terrain does not have the green colour as well.

What may be the possible source of error ? I am now using VS2005 and Win2K with DirectX 9 to compile

Thanks :D
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

I need some more detail here ...what did you recompile ...demo code? Also how is demo itself running ...one compiled by me?
Birdman
Posts: 25
Joined: Mon Jan 28, 2008 5:45 am
Location: Buenos Aires

Compiling on 1.4

Post by Birdman »

I tried to compile your source or the code you posted in "Using arras's Terrain Tile manage".

I get this error using VC 6.

main.obj : error LNK2001: unresolved external symbol "public: __thiscall ShTlTerrainSceneNode::ShTlTerrainSceneNode(class irr::scene::ISceneManager *,int,int,float,int,class scene::ISceneManager::ISceneNode *,int)" (??0ShTlTerrainSceneNode@@QAE@PAVI
SceneManager@scene@irr@@HHMHPAVISceneNode@23@H@Z)

Do this resource work with 1.4?
I will test it on DEVC++ later.

I starting to test something to develop a strategy game, so i needed this badly, your work seems a great addition to Irr :)

Thanks a lot for any help you could give
FlyingIsFun1217
Posts: 219
Joined: Fri Apr 13, 2007 8:29 pm
Location: Illinois
Contact:

Post by FlyingIsFun1217 »

Looks like an unlinked library error to me.

FlyingIsFun1217
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Yes it is linking error probably ...you did not set up something right in your project.

I was not testing it under Irrlicht 1.4 ...but since there were some changes from 1.3 there might be some problems, but not too much and all should be easy to correct.
Birdman
Posts: 25
Joined: Mon Jan 28, 2008 5:45 am
Location: Buenos Aires

Linker Problem

Post by Birdman »

I know, but since the Error have to do with the SceneNode Class, i think maybe something changed for 1.4, i don't get this error compiling any other Irr project, i really can't figure out what could be the problem.
The sleeper must awaken!
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

If it would be compile error, your compiler would probably give you line where problem occurred together with some clue of what caused it. I do not use VC 6 so I cant exactly however.

I was not compiling my demo under 1.4 since I did download it only recently. Also I am working on improving my node right now.

If I get some free time I'll try to compile under 1.4 and let you know...
sp00n
Posts: 114
Joined: Wed Sep 13, 2006 9:39 am

Re: Compiling on 1.4

Post by sp00n »

Birdman wrote:I tried to compile your source or the code you posted in "Using arras's Terrain Tile manage".

I get this error using VC 6.

main.obj : error LNK2001: unresolved external symbol "public: __thiscall ShTlTerrainSceneNode::ShTlTerrainSceneNode(class irr::scene::ISceneManager *,int,int,float,int,class scene::ISceneManager::ISceneNode *,int)" (??0ShTlTerrainSceneNode@@QAE@PAVI
SceneManager@scene@irr@@HHMHPAVISceneNode@23@H@Z)

Do this resource work with 1.4?
I will test it on DEVC++ later.

I starting to test something to develop a strategy game, so i needed this badly, your work seems a great addition to Irr :)

Thanks a lot for any help you could give
just include all *.h and *.cpp files to your project in VC (about DevC++ i can't say anything) and rebuild your app.
about 1.4 - there is some cosmethic changes for the compiling (declaration of the receiver, material texture changes in the code...) if you're need compiled version - PM to me - i can send it to you :)
Birdman
Posts: 25
Joined: Mon Jan 28, 2008 5:45 am
Location: Buenos Aires

Bad Luck

Post by Birdman »

No matter can i do, i can't compile this, :(

I reinstalled my PC, some thing i had to do, now i'm using DEV C++, i simply open the demo Project of Arras, and compile and i get this error.

15 main.cpp cannot declare variable `receiver' to be of type `MyEventReceiver'
15 main.cpp because the following virtual functions are abstract:
256 IEventReceiver.h virtual bool irr::IEventReceiver::OnEvent(const irr::SEvent&)

I added Irrlicht Bin and Include directories to the directory configuration in DEV C++ and recompiled IRR 1.4 DLL using DEV C++.

Note: About VS 6.0 i added the files to the project before reinstalling the PC and i was still having some errors, some code stuff..

Anybody compiled this on DEV C++ and 1.4?

Thanks for the help guys, and don't think i'm complaining or anything, i just want to use this code in a new project i'm starting, the first real project i will be doing in IRR.
The sleeper must awaken!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

The error is because of changes from 1.3 to 1.4. You have to make the parameter of the OnEvent method a const&, it was passed by copy before.
Birdman
Posts: 25
Joined: Mon Jan 28, 2008 5:45 am
Location: Buenos Aires

Other 1.4 Issues

Post by Birdman »

I had errors with this 2 lines

//Material[0].Textures[1] = CTexture;
//Material[0].TextureWrap[1] = video::ETC_CLAMP_TO_EDGE;

I replaced em with this lines.

Material[0].setTexture(1,CTexture);
Material[0].setFlag(video::EMF_TEXTURE_WRAP, true);

For some strange reason i couldn't use video::ETC_CLAMP_TO_EDGE.


I'm still having a strage error code 1 with makefile.win, since i'm new with DEVC++ i'm still trying to solve this out.
The sleeper must awaken!
morris
Posts: 36
Joined: Tue Jul 10, 2007 10:10 am

Post by morris »

i've been testing with your scene node for a while now, and i really like the lookings combined with the FPS - just exactly what i need :)

however, i wonder what the width and height parameters of the node actually do?? they don't seem to affect anything. you always get a rendersize*rendersize terrain. if width or height are bigger than rendersize, rendersize is made smaller and thats it. so whats the point in having these parameters in the first place?

also i found it quite hard to get out the (global) geometry data out of the node :D for collision. it seems that calling updateVertices() on all sectors somehow deleted some tiles or made them invalid. i got around that with copying all the code where tile data is "created" and building up all the geometry manually, which works okay for me.

other than that - very great work ;) keep it up!
cya
Post Reply