Jump to content

Rendering partially transparent entity with opaque child parts (and particles attached to parts)


Recommended Posts

So I have an advanced rendering problem here.

I understand that in order to add transparency you call GlStateManager.enableAlpha() and use GlStateManager(1,1,1,alpha) to change transparency.


However, I have a ghost deer with bones inside that I want to be opaque. How would I go about making only some of these transparent while they are still children of each other? Even better: is there a way I can keep the skeleton and the outer ghost layer seperate but have the rotations match (keep them attached without having their rendering attached?)

Here's what I want it to look like. I also seem to have this bug only the front ribs are visibile. The rest seemed to have disappeared as well as the hip area/leg attachment bones.




On the side, if anyone knows how I can keep a particle at a specific position (relative to the entity's heading)/attached to piece, I also need to know how to do that without using translates and some trig.

I'm not expecting for every part of this to be answered, as it is definitely an advanced question. I'm almost certain I'll have to figure out the invisible bones on my own, but if anyone has anything that could help with any of the above problems it would be great! Thanks!

Link to comment
Share on other sites

See how the slimes are done, they also have both a transparent and an opaque part. If I recall correctly it uses a separate layer to render the transparent part. I would suggest creating 2 separate models, render the opaque one in the main renderer and render the transcluent one in a separate layer.

As for the particles - you will have to go through a lot of trial and error positioning your particles correctly. You can use a client proxy to get the model, then get it's parts and get their offsets and position however due to the way models and their rendering work you can't get any dynamic properties of the model(such as rotation for example) since MC will use 1 model instance for every entity and as such you will only have the rotations of the last entity rendered.

An alternative hacky solution would be to spawn the particles directly in the renderer but make sure that you are not spawning the particle each frame but instead each tick. That way you can also get the current rotation of your part. Then you can construct a matrix, translate it by offset, rotate it by rotation, translate it by position and multiply your particle origin vector by that matrix to get the position. That is theoretical though, I've never tried anything like that.

Link to comment
Share on other sites

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.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

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