Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

 

My code: https://pastebin.com/qR8kJJDF

 

EDIT: The problem almost surely is not with my models, as I tested it with vanilla items, and the same glitch occurred, though since Minecraft items are flat it is not this much visible.

 

d.png

 

b.png

c.png

e.png

Edited by Nuparu00
Better picture

  • 2 weeks later...
On 12/6/2019 at 8:52 AM, Nuparu00 said:

the arms and the held item can clip through blocks, mobs, etc

Could you show an example of this? I'm not sure what you mean.

 

On 12/6/2019 at 8:52 AM, Nuparu00 said:

that it "disables depth"

That seems odd. For example, when I disable depth in one of my rendering sections, the arms and rendering turn out like this. (It's an opaque sphere.)
2019-12-14_17_44_59.png.c1bb188f4a7f2db64e62869dbb480f33.png

 

I think you may have been looking in the wrong location there.

In fact, I can't find any reference to GlStateManager#disableDepth() within ItemRenderer#renderItemInFirstPerson()ItemRenderer#renderArmFirstPerson(), RenderPlayer#renderRightArm(), or ModelRenderer#doRender().

Moreover, cull is actually disabled in RenderLivingBase#doRender().

 

To solve your problem, then, I think you need to disable culling, and enable depth.

That might just get you back to your original issue, but I'd like to make sure I understand what that is before I try and help there.

2019-12-14_17.42.13.png

Edited by SerpentDagger

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

  • 2 weeks later...
  • Author
 
 
 
 
On 12/15/2019 at 3:06 AM, SerpentDagger said:

Could you show an example of this? I'm not sure what you mean.

 

Here is a video that I recorded.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.