Creating a custom heightmap (?)

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
DarkDepths
Posts: 126
Joined: Sun Apr 02, 2006 1:21 am
Location: Canada

Creating a custom heightmap (?)

Post by DarkDepths »

Alrighty, first let me say, yes I know that tutorial 23 shows how to make a custom heightmap.

My question is, is there any benefit to doing it this way, rather than deriving a new SceneNode and creating the geometry manually?

I've done a bit of forum searching and it seems that when someone wants to create their own geometry, they are pointed towards tutorial 23. I've tried it out, and it confused the heck out me. On the other hand, creating a simple heightmap out of a Custom Scene Node seems relatively simple.

So yea... i was just wondering if there would be any significant benefit if I put in the extra time to try and figure out what is going on in tutorial 23?

Thanks a lot!
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

Well what I understand is that it's not really custom/manual way to create terrains, but all kinds of meshes, and how to manipulate them(skin).
Working on game: Marrbles (Currently stopped).
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

If you derive a new scene node (as in example 3, custom scene node), you need to do that part as well as what is shown in example 23. So you won't win anything from using a custom scene node. Moreover, you lose the ability to use hardware buffers, which causes your meshes to be much slower in rendering. That's why it is suggested to use a manually defined mesh all the time, instead of using a custom scene node. Custom scene nodes are only required if you want to alter the default way of rendering geometry.
However, custom heightmap is a very different thing. Heightmaps are just 2d images containing the height information in some way stored in their pixel colors. They are then used with the terrain mesh or terrain scene node to create the terrain geometry. This does not need any manual interation at all, you just load in the heightmap.
DarkDepths
Posts: 126
Joined: Sun Apr 02, 2006 1:21 am
Location: Canada

Post by DarkDepths »

Thanks for your responses.

I realize that there is a TerrainSceneNode with which I could use a height map. This isn't suitable for my needs. Basically, I want to replicate what the TerrainSceneNode does, but I have a few things that I need to alter in the process. I'm not worried about LOD'ing it right now, so that isn't really a concern. If I could just figure out how to create a basic height map generated mesh, I'd be happy.

I've never done any mesh generation though, I've always used modelling programs or the built in scene nodes, such as the cubeSceneNode.

From what I can gather then, it's best if I put a bit of time in to figuring out what is going on in example 23?


Edit: It just occurred to me that Irrlicht is Open Source, so since I'm basically trying to make a simpler version of the ITerrainSceneNode, I decided I should take a look at how it is implemented. I'm going to start reading there, I think :)
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

If you don't need LOD you can use the terrain mesh. smgr->getGeometryCreator()->createTerrainMesh(video::IImage* texture,
video::IImage* heightmap,
const core::dimension2d<f32>& stretchSize,
f32 maxHeight, video::IVideoDriver* driver,
const core::dimension2d<u32>& defaultVertexBlockSize,
bool debugBorders=false) const =0;

Pass in the heightmap as second parameter (first texture is diffuse map). This will automagically create the meshes from your heightmap. Supports arbitrary image sizes etc.
DarkDepths
Posts: 126
Joined: Sun Apr 02, 2006 1:21 am
Location: Canada

Post by DarkDepths »

I'm actually trying to do some funky stuff with the mesh itself, so that probably won't work out for me.

However... is it possible to edit the vertices of a TerrainSceneNode after loading it from a heightmap? That might be the easier way to go, if it can be done...
nespa
Posts: 167
Joined: Wed Feb 24, 2010 12:02 pm

Post by nespa »

hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

If you use the terrain scene node, it's quite complicated to change those vertices. But the terrain mesh (which is working completely different and unrelated to the scene node) is perfectly editable.
DarkDepths
Posts: 126
Joined: Sun Apr 02, 2006 1:21 am
Location: Canada

Post by DarkDepths »

Alright guys. Thanks for the info. I'll give it a shot and see what I can come up with!
Post Reply