Advertisement

Voxel rendering question, adding of blocks to a chunk confusion

Started by April 11, 2020 07:25 AM
3 comments, last by JoeJ 4 years, 9 months ago

I am confused about how Voxel chunks works when it comes to addition of new blocks.
All the 'best' tutorials out there including 'Lets make voxel engine' and youtube ones left out the addition/update of new blocks/voxel to the engine.
My question is, if say I have a 16x16x16 chunks in my world and say for example user clicks and add a block, after ray casting, the voxel block detected is part of a chunk that is already full (all 16x16x16 blocks are all filled), what will happen?
does it generate a new chunk and add to chunk list of the world?

I assume 16^3 chunk counts both empty and solid voxels. t's always just a cubical region of space, independent of content, and could contain 0 up to 4096 solid voxels.
So if a chunk is 'full', all its voxels are already solid, and nothing can be added anymore.

(sounds you were confused by thinking chinks contain only solid voxels?)

Advertisement

JoeJ said:

I assume 16^3 chunk counts both empty and solid voxels. t's always just a cubical region of space, independent of content, and could contain 0 up to 4096 solid voxels.
So if a chunk is 'full', all its voxels are already solid, and nothing can be added anymore.

(sounds you were confused by thinking chinks contain only solid voxels?)

ok so I am confuse on the part of “nothing can be added anymore”, I assume that a world can be represented by multiple chunks, say for example a 2x2 chunk (2 chunks in x, and 2 chunks in z), so say if chunk(0) is full and i will add a new voxel at the positive X side of chunk(0) which is already full, should it be added to chunk(1) or something?

Yes. If you raycast against any block from the full chunk, you hit one of the faces of solid blocks, and this face points outwards the full chunk to another adjacent chunk that must be partially empty.

So, if the raycasting mechanism is correct and robust, it never returns a target voxel for building that is already solid., but always a empty. So the problem you ask for never appears.

But not sure if i get you right. You may want to draw a image.

This topic is closed to new replies.

Advertisement