
Sort Errors Appearing Because View Bobbing is Applied After Terrain Setup
douira opened this issue ยท 0 comments
Bug Description
View bobbing applied to the camera position after we've processed the terrain setup means the real camera position is slightly different from the actual camera position used for rendering.
Concretely this results in wrong section sorting visible as bright lines between blocks of ice in frozen rivers. The sections are sorted such that they end up being rendered in the wrong order as seen from the real camera position.
Reproduction Steps
- Generate world
-3626056640687946264
and go toexecute in minecraft:overworld run tp @s -143.98 63.00 153.24 11.74 49.58
- Very slowly move diagonally across the section boundary right in front of you. You need to be walking, and view bobbing needs to be on.
- Observe a very faint light line between the blocks along the section boundary as you cross it.
Flying, which has no view bobbing, or turning view bobbing off makes it go away.
Notes
To fix this we would want to extract the camera position from the view matrix, but that might break mods that want to give sodium a different view position for some reason. This type of bug likely also affects culling and other view-dependent calculations. We need to decide how to do this without breaking things.
Thanks to @_adre278 on discord for finding this bug.