# Mesh generation and geomipmaps from voxel datas

This topic is 4247 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi. I'm working on a voxel terrain. I'm just handling geometry generation for now. For now, the terrain consists in an octree where leafs are 8x8x8bits (64bytes) containing 1(full) or 0(empty). If an octree node is totaly filled or totaly empty, I don't store its leafs. For mesh generation, I go down the octree and generate a Lego-look mesh for each 8x8x8 leaf. And the trouble comes here: I have to smooth each leaf/mesh in order to have a more 'normal' terrain. But I can't/don't know how to get neighbours mesh joint vertex. That gives me cracks and bad normals. The problem is the same for LOD. I want to make LODed mesh (geomipmaps) but without the link between vertices of the mesh, I can't achieve it. That problem is easy to solve when having heightmaps where each mesh has the same number of vertices, positioned periodicaly. Better with a (ugly) screen shot : http://www.azoted.com/terrainbadborders.jpg Did anyone succeeded using that method? Any other solution for the mesh generation? Thanks for your help

##### Share on other sites
So how are you generating the meshes? Marching cubes? I use marching cubes in my project and don't suffer from cracks - but I agree the normals are problematic and I haven't solved this yet...

##### Share on other sites
I started with marching cube. But generation is slower with it and normals aren't computed.
The principle of my 'lego' is simple. For every volume bit, I look at his 3 neighbours bit (up, right, front). If the current volume bit is different than its neighbours bit, I create a quad. The direction (CW or CCW) of that quad is determined by the current bit(1 or 0). So with that, for each bit volume, I create up to 3 quads. As the quads are aligned to an axis, each vertex using that quad have that axis for normal.
The normals are smoothed just like the vertices are.

##### Share on other sites
Quote:
 Original post by siaI started with marching cube. But generation is slower with it and normals aren't computed.

It's really not slow, in the past I've applied it to a 256x256x256 volume several time per second. And you can calculate the normals yourself, though I agree it's alittle bit tricky to get smooth shading. Have a look at my project here:

http://www.ogre3d.org/phpBB2/viewtopic.php?t=27394

The screenshots don't show smooth shading but it's in the latest (unreleased) version.

Quote:
 Original post by siaThe principle of my 'lego' is simple. For every volume bit, I look at his 3 neighbours bit (up, right, front).

Do you use all three directions even if you are on the on the edge of a leaf or not? The is, it you are processing a leaf's edge voxel, do you 'peek' into the next leaf?

##### Share on other sites
Yes, I get neighbours leafs.
marching cubes are good for hi frequency voxel like in your shots.
I want to use voxel for terrains like in Crysis ;) lower frequency, more need for LODs.

##### Share on other sites
Well I don't really know the answer to your problem, but I have a couple of interesting links for you...

http://www.ogre3d.org/phpBB2/viewtopic.php?t=30491

http://www.gamedev.net/community/forums/topic.asp?topic_id=439081

##### Share on other sites
Quote:
 Original post by siaBut I can't/don't know how to get neighbours mesh joint vertex. That gives me cracks and bad normals.The problem is the same for LOD. I want to make LODed mesh (geomipmaps) but without the link between vertices of the mesh, I can't achieve it.That problem is easy to solve when having heightmaps where each mesh has the same number of vertices, positioned periodicaly.

I believe you can start from this paper
Efficient Neighbor Finding Algorithms in Quadtree and Octree. It features an algorithm both for joints and edges (and even... faces) in octree.

Let me know if it works for you.

##### Share on other sites
"VISUALIZATION OF LARGE ISO-SURFACES", Demo & PDF.
www.xinix.org/sven/main/publications.htm

Paper only gives main ideas, you may ask the author for details.

##### Share on other sites
I'll post screens asap ;)

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 10
• ### Forum Statistics

• Total Topics
633652
• Total Posts
3013137
×