What is the process for generating meshes - for terrain etc - at run-time in Irrlicht? E.g., how do I add polys and build up a terrain mesh?
Also, what options does Irrlicht have for creating polys - can you assign an RGB color to each vertex, or do you need to use textures?
Generating run-time poly meshes
-
- Posts: 208
- Joined: Sun Apr 02, 2006 9:20 pm
Hello AW111,
Coincidentally I am looking at a terrain node too. Mine is going to be a spherical terrain for planets that combines a heightmap and noise function for 'planet scale detail' supporting terrain, water and atmosphere layers hopefully.
I am just at the test phase at the moment and what I am working towards is using a quadtree with each quad representing a patch of 17x17 vertices. each patch is currently stored in a mesh buffer making it simple to only change data for patches that have changed. When a quad is subdivided the intention is simply to hijack the parent buffer to the first child and create three new buffers for the others.
The following file simply creates a fixed flat series of patches (it is not a planet node but given your question it might have some clues in there for you.
(Edit: Link down project in review)
I may find this technique is useless and dump it in favour of a single buffer of verticies, in which case I will record patch vertex positions in the buffer and copy patches around as blocks of verticies as I add and remove patches. this is just a basic test and may totally change. Materials are broken at the moment.
Coincidentally I am looking at a terrain node too. Mine is going to be a spherical terrain for planets that combines a heightmap and noise function for 'planet scale detail' supporting terrain, water and atmosphere layers hopefully.
I am just at the test phase at the moment and what I am working towards is using a quadtree with each quad representing a patch of 17x17 vertices. each patch is currently stored in a mesh buffer making it simple to only change data for patches that have changed. When a quad is subdivided the intention is simply to hijack the parent buffer to the first child and create three new buffers for the others.
The following file simply creates a fixed flat series of patches (it is not a planet node but given your question it might have some clues in there for you.
(Edit: Link down project in review)
I may find this technique is useless and dump it in favour of a single buffer of verticies, in which case I will record patch vertex positions in the buffer and copy patches around as blocks of verticies as I add and remove patches. this is just a basic test and may totally change. Materials are broken at the moment.
Last edited by Frank Dodd on Sat Jul 31, 2010 7:17 am, edited 1 time in total.
That's remarkably similar to what I'm doing. Thank you for the help, and I'd be interested to see how your project develops.Frank Dodd wrote:Hello AW111,
Coincidentally I am looking at a terrain node too. Mine is going to be a spherical terrain for planets that combines a heightmap and noise function for 'planet scale detail' supporting terrain, water and atmosphere layers hopefully.
-
- Posts: 208
- Joined: Sun Apr 02, 2006 9:20 pm
I am going to create a project announcement on this is a few days, I will also upload the code again then too. I've got a spherical mesh now with the quads splitting as the camera gets closer the join function is almost there too for reducing density as the camera moves away.
I am using the geomipmapping technique, I spent quite a bit of time looking at the existing code that is out there but found it difficult integrating the modules that I found so, perhaps unwisely, I am working from the ground up. the geomipmapping technique is a simple but quite effective method so hopefully I might see this project to completion.
The only other released Irrlicht project of this type that I could find was 'Tarzan's Planet Node from the project IrrElite aka Adama Quest, its a nice icosahedron based node.
I am using the geomipmapping technique, I spent quite a bit of time looking at the existing code that is out there but found it difficult integrating the modules that I found so, perhaps unwisely, I am working from the ground up. the geomipmapping technique is a simple but quite effective method so hopefully I might see this project to completion.
The only other released Irrlicht project of this type that I could find was 'Tarzan's Planet Node from the project IrrElite aka Adama Quest, its a nice icosahedron based node.