Tiled terrain scene node

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 »

Hi hybrid, so what is proper: declaration local to for loop or not? (all code I saw until now declared wariables in for loop as local to that loop)

And what would be propre in secont case ...casting?
HLFat
Posts: 71
Joined: Sun Sep 24, 2006 6:55 pm
Location: USA

Post by HLFat »

I just CANNOT BELIEVE how neat this is!!

Been working with it all day.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

HLFat >> now you make mi frightened ...is it so full of bugs??
HLFat
Posts: 71
Joined: Sun Sep 24, 2006 6:55 pm
Location: USA

Post by HLFat »

No...No Bugs.

I'm just learning how to use it.

It should be a part of Irrlicht.

Now,ultra huge terrains are possible with just a few lines of code.
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

I am glad you like it. Thanks all for helping me to improve it ...and ...Happy codding in New Year 2007 :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Proper would be local to for loop in each loop, but this does not work with MS poop. So make it one variable in the scope surrounding all for loops. This will loose some optimizations for most compilers, but will work with VC++6.
And yes, casting will help.
HLFat
Posts: 71
Joined: Sun Sep 24, 2006 6:55 pm
Location: USA

Post by HLFat »

I just made an 'endless' terrain by entering the other side as I leave a side.

Of course, It flickers a bit at the transition, but not as bad as I expected.

Maybe I can disguise it with some fog.

However, the important thing is, you never see the terrain edge.

Unless the camera is real high.

In which case,simply move back the transition point.
HLFat
Posts: 71
Joined: Sun Sep 24, 2006 6:55 pm
Location: USA

Post by HLFat »

However, I am still confused about 'smoothNormals'.

I comment it out,and don't see a change.

Tried if with various terrains.

Sure it's doing something?
Aardaerimus
Posts: 3
Joined: Sun Dec 31, 2006 4:22 am

Arras

Post by Aardaerimus »

I appreciate the warm welcome, and the time you took to reply. I think I'm finally starting to grasp the basics of this.

Regarding map creation, I see that you're creating a random terrain. Where does the map data go? Is it simply constructed in memory only to evaporate when closed? Is there a way to create a permanent map, and manually add patches of textures to specific parts?

For example: The terrain is all "grass" tiled, but I have a "dirt" tile I want to place patch of on a hill top, and I want it to always be there.

Thank you very for helping out! Sorry to badger you with silly questions.

- Aardaerimus
isIrrNewb(true);
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

HLFat >> on creation, all normals of terrain vertices point up x,y,z=0,1,0
smoothNormals recalculate normals acording to position of vertices around to point in 90 degree angle to terrain in that place. You can notice it on some slope for example.
Normals are important only for one thing in Irrlicht: they afects how light afects vertices of your node. In order to se diference make sure lighting is turned to true for terrain (should be default) and place some dinamic light at the position angled to terrain.

In demo you can see darker polygoons on slopes which are facing away from light source. If smoothNormals function would not be used afther terrain was generated all polygoons would be lit in the same way.

Aardaerimus >> map data are stored in "data" array created in memory with new in constructor and removed with delete in destructor. So basicly they disapear once class stop to exist.
If you want to preserve data in your program you need to store them somewere else. Howe to store them is up to you. I suggest using another array similar to one used by TlTerrain class. To get acces to data use functions getHeight() and getNormal(). There is no function to get UV coordinates of tiles (may be it would be good idea to add one) so you must store that since the begining.

To place your "dirt" on some tile of your terrain use setTileUVs function. Both grass and dirt must be part of one texture however. Look at terrain.bmp texture in Data folder of demo.
Belshamaroth
Posts: 24
Joined: Sun Apr 09, 2006 8:19 pm

Post by Belshamaroth »

i played around a little bit with the headers being able to add tangents and binormals to the terrain (using the calculation used in the mesh manipulator). a thing made me wonder was that there was not a big difference visible on the FPS count if you use parallax mapping on the terrain.. with the normal ITerrainSceneNode there is a big difference between parallax mapping and none. (might be because the geomorphing lacks in parallax mapping)
HLFat
Posts: 71
Joined: Sun Sep 24, 2006 6:55 pm
Location: USA

Post by HLFat »

Just tried adding a 'addWaterSurfaceSceneNode '.

Didn't work that well, but I won't give up.

That's why I like the the Irrlicht community..'Anything's Possible'.
rs199483
Posts: 8
Joined: Thu Jan 04, 2007 9:11 pm

Irrlicht 1.2

Post by rs199483 »

Has anyone had any troubles compiling and/or running this with 1.2?
I get a compile error: c:\GameDevelopment\irrlicht-1.2\include\vector2d.h(58): error C2668: 'sqrt' : ambiguous call to overloaded function

Also when I run the .EXE demo it starts up and loads and then crashes before it displays the terrain...

I am using visual studio 2003.

Sorry if I missed reading a post about this...
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

Belshamaroth >> I have no idea why is it fasther since I don't know howe ITerrainSceneNode realy works. My code is not based in any way on it. It was rather developed from Custom Scene Node Example.

HLFat >> I plan to make my own water surface node which should be similar in principle to TlTerrainSceneNode. However right now I have lot of work and not too much free time for that so it probably not gona be soon.

rs199483 >> yes it was already discused here, try to read posts bmade by lug, it should help.
HLFat
Posts: 71
Joined: Sun Sep 24, 2006 6:55 pm
Location: USA

Post by HLFat »

I have come to the conclusion that I need to generate a 'hole', an area where the texture is not rendered, or possibly, even where the mesh is not generated.

Your source is a great inspiration to anyone who wants to expand Irrlicht and generate their own SceneNodes.
Post Reply