CaffeineMC / sodium-fabric

A Minecraft mod designed to improve frame rates and reduce micro-stutter
Other
4.76k stars 810 forks source link

Section sorting is incorrect #2266

Open MeeniMc opened 9 months ago

MeeniMc commented 9 months ago

Bug Description

In some rare cases, the section sorting is (still) incorrect and will cause a particular section of stained glass to not render.

image Bottom right section of the stained-glass wall is missing. See how the missing section boundary does not align with the stained glass block pattern. Screenshot taken with #2016, but can be replicated on commit 17a17ede

The missing section is position/angle dependent. It is not time or reload dependent (f3-a or full reload will determistically show the same missing section at the same place)

The bug is not due to #38, as it does not get fixed by Douira's translucency sorting (#2016) The bug did not get fixed at the same time as #2234 17a17ede

Reproduction Steps

  1. gradlew runclient
  2. create a new world with seed 4957284180073197783
  3. /execute in minecraft:overworld run tp @s -24.50 77.00 -53.50 117.00 2.40
  4. /fill -64 63 -44 -64 100 -140 minecraft:white_stained_glass

Log File

latest.log

Crash Report

crash-2024-01-18_10.17.13-client.txt

douira commented 9 months ago

Screenshot at 17a17ed Screenshot 2024-01-18 at 15 58 10

Rotating or moving the camera makes the problem disappear quickly but not immediately.

douira commented 9 months ago

The boundary where the glass is correctly layered appears to be Z=-128 given the dimensions of the glass block and the fact that there's 12 broken blocks. The lower boundary is Y=64 which also points to this being a region-related issue.

douira commented 9 months ago

Same world but I found a case where the number of rendered sections does not change:

/execute in minecraft:overworld run tp @s -31.94 77.00 -54.59 106.80 31.95 Screenshot 2024-01-19 at 03 27 13

/execute in minecraft:overworld run tp @s -31.94 77.00 -54.59 106.95 31.80

Screenshot 2024-01-19 at 03 28 16

RD 15, FOV 70 (default). The render resolution (or at least the aspect ratio) 3768x2214 is relevant as it changes the shape of the frustum.

jellysquid3 commented 8 months ago

As was discussed in the Discord server, nobody seems to know what's going wrong here. The problem even exists in Sodium 0.4, which uses a completely different implementation of the graph traversal code.

Likely there's something fundamentally wrong about how region sorting is handled, and this will require some significant work to properly fix.

douira commented 2 weeks ago

the new linked PR should fix this. Let me know if it works.

MeeniMc commented 2 weeks ago

confirm PR fixes the issue