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