FalseTweaks

FalseTweaks

101k Downloads

"Z fighting" on enchanted items

kotmatross28729 opened this issue ยท 7 comments

commented

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

commented

Should be fixed in 2.0 alpha 3

commented

Should be fixed in 2.0 alpha 3

hmm doesn't seem to work

2022-09-25.10-25-10.mp4
commented

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):
things

commented

This solution would result in the glint going outside the item itself though, that part is not really fixable
Screenshot_2022-09-25_09-54-54
Screenshot_2022-09-25_09-55-10

commented

well, I can still see it

2022-09-25.16-15-47.mp4
commented

beta 3, the bug seems to be less noticeable than it was,

2022-10-03.09-12-06_Trim.mp4
2022-10-03.09-12-38.mp4

but with shaders it is very noticeable

2022-10-03.09-13-32.mp4
2022-10-03.09-13-09_Trim.mp4
commented

did not notice when, but there is no error in the latest release