Improved getting neighbor chunk voxels#7
Conversation
|
(Also the separate loops from before will run much faster because of that memory being accessed in sequence, meaning there is a high chance the cpu still has the data cached) |
Yes it should use the extra corner blocks to correctly calculate AO values After testing I did find getting neighbour data using one loop is faster on average by 1 microsecond on my machine but I found a better solution: |
|
Ah yeah, nice update! Though, now you might realize that; by processing each plane individually, you actually end up processing the corner blocks multiple times. What I did after I realized that, was separate the loops a bit further, and then you end up with the implementation I have in my MR (#6). Notice how I separate the loops, I found that if I focus the loops on removing the z access jumps, the code would run much faster. |
yeah but it should be quite easy to skip corners I can just change the start and end range of certain loops |
Only CHUNK_SIZE x CHUNK_SIZE amount of blocks per side of a chunk have neighbours
so only CHUNK_SIZE x CHUNK_SIZE amount of blocks are added as padding per chunk side instead of CHUNK_SIZE_P x CHUNK_SIZE_P blocks.
Method to add neighbours are moved into a single nested for loop since the chunk is assumed to be a cube therefore every side of a chunk have the same amount of blocks