# Making a planet using marching cubes/voxels

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

## Recommended Posts

[sharedmedia=gallery:albums:1109]
pic showing current results

HI, I'm working on a planet renderer using voxel chunks and marching cubes.

The problem I'm having seems pretty simple. The function I'm using to define a sphere in the voxel data isn't working....I'll explain...

Basically I represent the planet as a number of cubical chunks of voxel data arranged in a big sphere.  Although I intend to use 3d noise to make terrain shapes later, right now I'm just trying to make a smooth sphere of a certain radius. Obviously, this sphere will be be made up of multiple chunks.

I should have enough chunks layered so that I can extract an isosurface for each at a given radius ..this should give me my basic planet.

each voxel chunk is currently an 8x8x8 block of float values.

to define a sphere in the voxel data I am currently using this function: radius-vector_length(voxelpos);

This assumes that the voxel position is the worldspace position (x,y,z) of each voxel. Each voxel should have a unique position..  The length of that vector is used because I assume the center of the planet is at 0,0,0

The position of a voxel is calculated this way...

voxelpos.x = ?position_in_chunk + chunk_position

Anyway... I hope this is enough information to make some sense of what IM asking. The result is not what I want, with the geometry in each chunk seeming offset somehow, and the angle of the surfaces off... I'm pretty sure the marching cubes method I'm using is working OK

Edited by Matt_Aufderheide

##### Share on other sites

Is this just a bug, or do you see a conceptual issue that you'd like us to resolve?

your basic idea seems fine, it just looks like a bug.

- try using one big chunk first instead of the chunked method to verify.

- try using simple voxel boxes first instead of marching cubes

##### Share on other sites
[sharedmedia=gallery:images:7685]

Well it works fine when using only a single chunk.. so the problem is how I'm using multiple chunks.. at least I know the basic method is working OK..

##### Share on other sites

Ok got it working.. basically it was just a matter of flipping some of the corrdinates around, there was nothing really wrong with the system. I just had to flip z/y in one place that I had missed earlier.. it funny how these simple bugs can drive you absolutely crazy, and you start questioning your basic concept...

Thanks

##### Share on other sites

Funny. I just posted a topic on "how do you make one"..... didn't look at the posts to see if anyone had posted similar.

Can you point me in the right direction to learn how to do that? Do you know of any limitations on size of the planet? Is your method using some kind of LOD like quadtree?

##### Share on other sites

I'll make a post in your topic....

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

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

• Total Topics
633653
• Total Posts
3013157
×