[font=arial]I have fixed a problem that has bugged me for quite some time. For most of the development of SeedWorld, up until last week, every chunk was not able to access voxels from immediate neighbors. This shortcoming was avoided with the code for voxel collisions, which worked by finding the right[/font]
[/font][/color][color=rgb(51,51,51)][font=Georgia][font=arial]chunk from the group of chunks to test whether a block is solid or empty, given world coordinates as input. But sometimes you needed to find out based on local coordinates, relative to a chunk's location. This was evident in the mesh building process, as it did ray casting from each visible voxel to determine if a voxel needs to be shaded darker, and by how much.[/font]
[/font][/color][color=rgb(51,51,51)][font=Georgia]
[font=arial]The edge voxels were a problem for raycasting since it could not raycast further out from the edges of the chunk. Any rays that reached the edge were considered "not blocked" and the voxel received full light. This created a seam of lighter colored voxels around the edges.[/font]
[/font][/color][color=rgb(51,51,51)][font=Georgia]
[font=arial][/font]
[/font][/color][color=rgb(51,51,51)][font=Georgia]
[font=arial]Now since each chunk now has access to its eight neighbors surrounding the sides, you can simply make the ray "step into" these chunks and continue traveling the distance it's supposed to instead of ending prematurely. My first attempt to fix this didn't go well. I was modifying the starting coordinates of each ray and using that to find the neighbor chunk. It ended up looking worse:[/font]
[/font][/color][color=rgb(51,51,51)][font=Georgia]
[font=arial][/font]
[/font][/color][color=rgb(51,51,51)][font=Georgia]
[font=arial]These seams appeared because the ray was checking against the solid voxel it started from. So it always subtracted contribution from the light, making the edges dark. This was fixed by updating the ray coordinates after each step, seeing if they go out of bounds (from 0 to 32) and then picking the correct neighbor chunk to continue and reset the local coordinates. Now the seams are gone and the shading is correct.[/font]
[/font][/color][color=rgb(51,51,51)][font=Georgia]
[font=arial][/font]
[/font][/color][color=rgb(51,51,51)][font=Georgia]
[font=arial]Now the chunks don't look as obvious. This was pretty satisfying to fix, and probably so much that I will move on to work on other parts of the game. There are still visible seams at height intervals (because rays don't have neighbors to check on the Y axis) but this is still a lot better than seeing an entire grid of lines going across the landscape. So it's not something I am focused on improving at the moment.[/font]
[/font][/color][color=rgb(51,51,51)][font=Georgia]