voxel / voxel-land

a terrain generator with grass, dirt, stone, and trees (addon for voxel-engine)
6 stars 2 forks source link

Extreme terrain at chunk edge? #18

Open lawik opened 9 years ago

lawik commented 9 years ago

I'm experimenting with using a modifed voxel-land module to generate my landscape. I have currently changed chunk size to 64 to more clearly show the problem I'm having.

Is this normal? Those vertical edges as chunks with vastly different terrain meet. They do not feel normal.

chunk-edges

I have made modifications, specifically I've modified the stuff passed to showChunk to be compatible with the normal voxel.meshers.greedy mesher:

var chunk_data = {
    voxels: chunk.data,
    position: chunk.position,
    dims: [self.opts.chunkSize,self.opts.chunkSize,self.opts.chunkSize]
}
self.game.showChunk(chunk_data);

Or is this a consequence of not using voxel-mesher for voxel-land?

lawik commented 9 years ago

Ah, I seem to be treating the ndarray badly. I should probably not be touching chunk.data directly in that way. I will experiment further with converting the data to what the greedy mesher wants.

lawik commented 9 years ago

It seem I might have treated the ndarray quite okay.

Getting some other issues where along the chunk edges I get a raised line of blocks on every chunk edge. Any thoughts on how this could be? Also interested in why it is that I don't get a more uniform landscape from chunk to chunk.

deathcap commented 9 years ago

@lawik it looks like the noise function is not continuous over the chunks, this could happen if the noise is sampled at a different position than the chunk dimensions expect. You might also try tweaking the chunkPad option in addition to chunkSize.

But I believe why you're seeing this problem, is that voxel-land is expecting a voxel-engine#ndarray engine, which is why it passes a raw ndarray instead of the {voxels, position, dims} chunk_data object — that's for the "older" (current, three.js-based voxel-engine). If you switch to voxel-engine#ndarray it should work, on the other hand, maybe voxel-land could be modified to support both chunk formats.

Older versions of voxel-land used the old format, changed sometime around this commit: https://github.com/deathcap/voxel-land/commit/c01750c3d44e57a33f041b99014e74565155ffe8 GH-12