In my mod, I am rendering custom first-person arms when certain items are held. I managed to do this and it works and looks quite well. However, there is one major issue - the arms and the held item can clip through blocks, mobs, etc.. So I looked at how Minecraft renders its arms, and figured out, that it "disables depth" ( using GlStateManager.disableDepth() ) so the arms are rendered on top of everything else + it also enables culling ( GlStateManager.enableCull() ).
I call these before rendering the arms (and also their "opposite functions" after rendering the arms), and it works - the arms are rendered as the vanilla ones. However, it doesn't work with complex items. It seems that this disables the "depth check" even between vertices that are part of the item, so the faces that are hidden and face the camera are rendered on top.
I am pretty sure that my models are not the issue, as I tested it with vanilla items, and the same glitch occurred, though since Minecraft items are flat it is not this much visible.
Hi.
In my mod, I am rendering custom first-person arms when certain items are held. I managed to do this and it works and looks quite well. However, there is one major issue - the arms and the held item can clip through blocks, mobs, etc.. So I looked at how Minecraft renders its arms, and figured out, that it "disables depth" ( using GlStateManager.disableDepth() ) so the arms are rendered on top of everything else + it also enables culling ( GlStateManager.enableCull() ).
I call these before rendering the arms (and also their "opposite functions" after rendering the arms), and it works - the arms are rendered as the vanilla ones. However, it doesn't work with complex items. It seems that this disables the "depth check" even between vertices that are part of the item, so the faces that are hidden and face the camera are rendered on top.
I am pretty sure that my models are not the issue, as I tested it with vanilla items, and the same glitch occurred, though since Minecraft items are flat it is not this much visible.
My code: https://pastebin.com/qR8kJJDF