Some servers do not always send adjacent chunks, causing terrain to not render with Sodium
jellysquid3 opened this issue ยท 1 comments
Sodium requires that all neighbor chunks are present before it will notify the renderer of a chunk's existence. This means that it isn't possible to have the renderer forcefully render chunks that are "too close" to the camera, like vanilla currently does.
For example, the Hypixel server only sends a single chunk when in the limbo dimension, which isn't enough for Sodium to render anything. This case could be resolved by forcing the chunk the player is standing in to always be meshed, even if neighbors aren't available.
However, fixing this will require some refactoring:
- The chunk tracker needs to be adjusted to no longer wait for neighbors before notifying the renderer.
- The renderer will need to create a render object for every chunk, even those without neighbors. The "neighbor count" which was previously stored inside the chunk tracker will need to be moved into the render object.
- The chunk occlusion culling code will need to be updated to not traverse along edges of chunks which do not have a loaded neighbor. When a chunk gains all of its neighbors, the step for connecting neighbor edges should be performed.
- The code for scheduling chunk updates will need to be updated to always enqueue chunks which are close enough to the camera. This may not be possible if the occlusion culling code cannot traverse along unloaded edges, so we may need to make the step of scheduling chunk updates fully independent of the occlusion culling code.