Closed terrac closed 7 years ago
Hey, this isn't reproducing for me. In the link I just see the world as big solid chunks, and if I remove random blocks I don't see any missing textures. I'm testing in windows/current chrome. Can you narrow down the issue or reproduce it minimally?
Here is a better example http://www.voxel-verse.com/exampleError/ I modified one of the examples on the engine
Basically I changed anything with an id containing a 2 to be completely filled. It looks like that area is empty until you interact with it.
Ah, I see the problem now. Here is the short answer:
noa.world.on('worldDataNeeded', function (id, data, x, y, z) {
// the logic for determining each voxel should depend only on its x/y/z coordinates
// it should not depend on "id", and should not be random
})
The long answer is, for internal reasons this library stores each chunk as a padded array containing the voxels for that chunk, plus a one-voxel buffer overlapping into neighboring chunks. As such, when the worldDataNeeded
event asks the client for data, voxels on the border between two chunks will get requested multiple times - once for the chunk they're part of, and again for any chunk they're on the border of. Since those multiple requests will have different chunk IDs, if you base voxel data on the chunk ID then you wind up returning two different values for the same voxel. So one chunk thinks that voxel is solid and the next chunk over thinks it's empty, which causes rendering bugs.
Hope that's clear!
That makes sense, thanks for clarifying.
http://www.voxel-verse.com/?saved=6cda3400-1533-4e1c-a58a-7534dad05189 to see in action
Some videos of the behavior https://www.youtube.com/watch?v=MrePw08JzvQ&feature=youtu.be
https://youtu.be/0jxOFhajDUk
Basically as far as I can guess I think that if one chunk is a solid set of blocks, but the ones surrounding it are empty then it will see through the chunk.