Sodium

Sodium

49M Downloads

Fix Z-fighting on enchanted models with coplanar intersecting faces

muzikbike opened this issue ยท 3 comments

commented

Request Description

This issue (https://bugs.mojang.com/browse/MC-262933) is much the same as #2454, and I assume could be fixed in a similar way - compute some outer shape for the model and apply the enchantment glint to that, rather than just throwing it on the textures directly.

The easiest way to reproduce this without a resource pack is to enchant a wall, then observe it from below - despite the texture being mapped identically in the area of intersection, Z-fighting arises nonetheless.

2024-05-09_10 43 46
2024-05-09_10 43 54
2024-05-09_10 43 59

commented

Minecraft uses a VertexConsumer proxy to generate new geometry for the glint overlay, and it does this at render time so we don't have any opportunity to bake. It would probably be to slow/error prone to try and de-duplicate geometry as well. The only solution in my mind is to stop generating geometry and apply the effect directly in the shader, which the game doesn't do already for some reason.

commented

I'm not going to rule this as "out of scope" quite yet, since fixing this inherently means solving a major performance issue that does appear in the real world.

But probably we should merge #2487 and #2486, since they're symptoms of the same problem (inappropriately using additional geometry.)

commented

Closing in favor of #2497 since the issues you have reported about enchantment glint are fundamentally the same problem.