deformation of terrain in real-time

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.
Post Reply
blabla

deformation of terrain in real-time

Post by blabla »

Hello :D

I'd like to deform terrain in real-time(e.g. by impact of rockets or sth. like that).

Are there any existing solutions for this problem ?

I know that there's a lib (libMini for irrlicht) for terrain generating, but i could'nt find out if it has the ability to do changes to the terrain in real-time?

Another question: Is it possible to generate terrains randomly?. (Create a random heightmap during runtime and then build/generate a terrain out of the heightmap)


Any info would be nice ! :D
tip
Posts: 50
Joined: Fri Feb 13, 2004 8:53 am
Location: grenoble, France
Contact:

yes it's possible

Post by tip »

hello,
yes it's possible. If you rely on Irrlicht's CTerrainSceneNode, it won't be that easy because it doesn't expose the vertice array (it's a MeshBuffer, a SMeshBufferLightMap to be more precise) that contains the vertice position. But this require to change it in every patch (sub-resolution precalculated meshes), so it won't be that easy if you're not familiar with the LOD terrain generation.

So i advise either three things, you choose depending on your skills and features you need :
- either you make you own terrain, without paches and LOD : you just make a addHillPlaneMesh and change the vertice position in Y
- either you use Irrlicht's terrain engine : you simply change the vertice position in every patch. You'll need to change the CTerrainSceneNode source code to make the meshBuffer public or add a fonction to manipulate the vertices
- either you make your own terrain class

to make random relief, i advise either
- fractal cloud
- perlin noise

i've done some source code for that, it's big, maybe i can release it if can help...
Guest

Post by Guest »

hi tip - thx for reply

"Depending on my skills" i would prefer the first option ;)

At the moment i'm not able to test it, but if the results of addHillPlaneMesh() look good enough ( irrlicht doc says:"It is uses mostly for quick tests of the engine only.") it should be sufficient.

For all that im interested in your source (if there are some comments ;) )
Maybe i can learn something.

Apropos: Do you know where i can find infos bout LOD terrain generation ??
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Anonymous wrote:Do you know where i can find infos bout LOD terrain generation ??
CTerrainSceneNode.cpp
CTerrainSceneNode::OnPreRender()
CTerrainSceneNode::render()

May the source be with you!
tip
Posts: 50
Joined: Fri Feb 13, 2004 8:53 am
Location: grenoble, France
Contact:

Post by tip »

the question was, as i understood, how do you dynamically modify the altitude of terrain vertices.
Of course you can rewrite the heightmap and re-prerender() but it may not fit some performance requierments if it's in real time.

I'll make a page for my terrain project. give me the week end for that...
I'm not sure it's simpler than irrlicht's built in one because it's more evolved (infinite terrain, dynamic tesselation, dynamic texturing, ...)
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

I can't look at the exact code for Irr 0.11 for the terrainNode, I have it heavily modified with a lot of changes, but if I recall, there have been posts about this before, and it's not hard to do at all. Changing Y values of vertex positions, slightly, isn't a problem, the thing is, when Y values are changed, bounding boxes aren't recreated, so culling may be off a little bit.

All you have to do, is get the MeshBuffer and modify the vertex data, very simple process actually.
Image
blabla

Post by blabla »

thx for all the answers!

And if you say it isn't that difficult to change y-Values of the meshBuffer i'll try it...


btw: If someone has already done some projects with real-time terrain-deformation - some links to bin/source would be interesting :D
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

I looked at the code....

The function call GetMesh() will return you the mesh of the node, which has the SMeshBufferLightMap meshBuffer with all the vertex data.

If you modify that, you will need to add a function to the TerrainNode that copies those vertices to the RenderBuffer vertices. Only a slight modification, if you can't figure it out, I'll post up some code changes to make it possible. I'm changing the way the terrainNode works slightly, and hopefully Niko will take the changes. The new way will use the Mesh as static mesh data, and the RenderBuffer will by scaled, position, rotated, whatever dynamic Mesh data. This will be necessary for geoMorphing calculations.
Image
leebojammin
Posts: 16
Joined: Thu Jun 15, 2006 8:45 pm

Post by leebojammin »

Spintz wrote:I looked at the code....

The function call GetMesh() will return you the mesh of the node, which has the SMeshBufferLightMap meshBuffer with all the vertex data.

If you modify that, you will need to add a function to the TerrainNode that copies those vertices to the RenderBuffer vertices. Only a slight modification, if you can't figure it out, I'll post up some code changes to make it possible. I'm changing the way the terrainNode works slightly, and hopefully Niko will take the changes. The new way will use the Mesh as static mesh data, and the RenderBuffer will by scaled, position, rotated, whatever dynamic Mesh data. This will be necessary for geoMorphing calculations.
not to sound igorant [intended] or anything but...;)...what exactly is to be modified..I am just starting out game dev [ ok barely starting but who's counting ] and could use some advise on that PLUS:

is it possible to change texture at point of deform and if so how ?

thank you kind sirs and misses..

leeboJ.
gfxstyler
Posts: 222
Joined: Tue Apr 18, 2006 11:47 pm

Post by gfxstyler »

what you need to deform: the vertex
can you change the texture: no

:)
Post Reply