Sodium

Sodium

44M Downloads

Frustum culling can rarely change the draw order of render regions

douira opened this issue ยท 4 comments

commented

Bug Description

The render order is wrong in this situation which leads to sorting artifacts. Since the artifacts go away with camera angle, it's not a normal translucency sorting problem.

Screenshot 2024-01-04 at 04 45 08
Screenshot 2024-01-04 at 04 45 06

Reproduction Steps

  • Make a world with seed -1209221951706518130, RD 2 is enough. According to @Lolothepro, it needs FOV <= 71
  • Run /execute in minecraft:overworld run tp @s -2091.80 82.74 -1928.06 47.84 23.10
  • Observe a line in the ice near the bottom of the screen
  • Run /execute in minecraft:overworld run tp @s -2091.80 82.74 -1928.06 50.54 25.80
  • Observe the line disappear

The tp commands only differ in camera facing.

Log File

2024-01-04-7.log

Crash Report

crash-2024-01-04_14.47.36-client.txt

commented

Clarification so that the next person isn't unable to reproduce for 5 minutes: in the third step, you just need to turn your head, not actually move the player. ๐Ÿ˜†

commented

Note: FOV <= 71

commented

The problem is that regions are only enqueued when a chunk section is visible... This means if a chunk section is skipped due to frustum checks, it will not update the ordering of regions, and in the edge case demonstrated here, will break things.

The solution is trivial (update the regions list before failing any chunk sections) but it will require some minor code refactoring.

commented

Fixed with 27e531f.