
"Z fighting" on enchanted items
kotmatross28729 opened this issue ยท 7 comments
Sorry, again.
In general, I found such a thing, it's called something like "Z fighting" or something like that.
Can be seen on enchanted items
Z.fighting.issue.mp4
Same with shaders:
Z.fighting.issue.with.shaders.mp4
In 1.8 and above, there is no such thing (I did not find what a vanilla bug is, but I was told that it is there)
1.8.mp4
Edit:
Looks like I found something similar.
MC-93554
Should be fixed in 2.0 alpha 3
hmm doesn't seem to work
2022-09-25.10-25-10.mp4
So i've looked more into why this actually happens, the current way of rendering the glint is that Minecraft sets the opengl depth buffer to only draw if the pixel has an equal depth to the one already on the screen.
This works in theory, but due to opengl rounding errors, does not result in the exact same pixel depths, and that's what causes this flickering.
My proposal for fixing this issue:
Instead of rendering enchantment glint as a 1:1 scale overlay, i would render it as a shell around the object instead, eliminating any chance of Z-fighting.
A rough sketch of how it would work like (the ingame render would only have an offset of 0.001 or somewhere in that range):