Jump to content

Recommended Posts

Posted

Hello!

 

Due to my derp nature, I felt the need to make a door mob in-game (literally, a door which walks around and beets the shizz out of you). As many of you may know, you can only ever see up to three sides of a block when you look at it, this means if the block is transparent, you can't see textures from the other side of the block.

 

This is the case for doors as well. Doors have a window in the top part of the block, because of the above rule you can look through the window and never see the other side of the door.

 

Unfortunately, this rule doesn't apply to rendering mobs. Mobs appear to have all sides rendered, meaning if you have create a door and look through the window you will still see the back of the door.

 

An screenshot below I took illustrates this:

 

width=800 height=424DvTJrqK.png?1 [/img]

 

Could somebody please explain to me how I would create a mob with the same effect as the door has.

 

I haven't supplied code because I didn't feel it was needed, if code is needed please ask.

 

Thanks!

 

~Joe

Posted

But this would make one side look like it has a massive hole in it, surely that's worse?

 

I had hoped there was some option to disable rendering invisible sides.

Posted

I had hoped there was some option to disable rendering invisible sides.

 

The problem is that the back side is NOT invisible.  I mean the transparency on the front side means that the graphics engine will try to render the back too -- I think even with culling it would decide that it should be rendered.  I'm not expert on this, just thinking that a good graphics engine would try to do that.

 

But this would make one side look like it has a massive hole in it, surely that's worse?

 

Well, it is good to be picky, but I'm not sure it would look that bad -- I'm suggesting to just remove the lattice between the panes in the window on the back side.  There would still be the lattice on the other side which people would see from the back (indeed that is your current problem from the front).

 

Anyway, someone that is good with the rendering may know a better way to do client-side disabling.  However, a block is different than an entity because blocks have a regular model and so the idea of sides is well-defined whereas generally entities have all sorts of moving pieces and so I don't think there is a general solution.

 

One other idea is to swap the texture depending on what side of the entity is facing the player running the client.  That would take a little bit of coding, but shouldn't be too hard.  So you could use a texture with the back transparent if the front is facing player, and use a texture with the front transparent if the back is facing the player.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Try comparing the yaws of your entity and the player and switching between two textures depending on what side of the door the player is facing. Each texture would have a different side of the door transparent!

Posted

I had hoped there was some option to disable rendering invisible sides.

 

The problem is that the back side is NOT invisible.  I mean the transparency on the front side means that the graphics engine will try to render the back too -- I think even with culling it would decide that it should be rendered.  I'm not expert on this, just thinking that a good graphics engine would try to do that.

 

But this would make one side look like it has a massive hole in it, surely that's worse?

 

Well, it is good to be picky, but I'm not sure it would look that bad -- I'm suggesting to just remove the lattice between the panes in the window on the back side.  There would still be the lattice on the other side which people would see from the back (indeed that is your current problem from the front).

 

Anyway, someone that is good with the rendering may know a better way to do client-side disabling.  However, a block is different than an entity because blocks have a regular model and so the idea of sides is well-defined whereas generally entities have all sorts of moving pieces and so I don't think there is a general solution.

 

One other idea is to swap the texture depending on what side of the entity is facing the player running the client.  That would take a little bit of coding, but shouldn't be too hard.  So you could use a texture with the back transparent if the front is facing player, and use a texture with the front transparent if the back is facing the player.

 

In fact, I think it would be easier (possible more efficient?) to just create a model which is made of 6 cubes shaped like a door, that way the "inside" sides of the cubes could be textured to be transparent.

 

The only problem I could see, is Techne seems to have a bug when texturing objects - if I have two cubes in Techne, they will use the same coordinates on the texture map meaning I can't have individual textures :S Please not it is completely possible that this is not a bug and is me being a derp; I don't have to time to conduct proper research right now :P

 

I think that the reason blocks have this feature and entities do not is because entities are more subject to moving around and exposing the "invisible" sides. Blocks don't turn around, the only way the invisible sides can be rendered is for the player to move around the block.

 

Try comparing the yaws of your entity and the player and switching between two textures depending on what side of the door the player is facing. Each texture would have a different side of the door transparent!

 

This may be the way I have to go, but it seems a bit sloppy? I would need 6 textures, which seems a bit stupid :S

 

Why? The door has 6 sides, therefore there are 6 possible combinations of the 3 sides the player can see, for each one of those combinations there are 3 sides which should be invisible. I certainly don't like the sound of having to:

 

a) make 6 textures for each one of these blocks I am making (more blocks to be like this one)

 

b) use this method - I hate hard coding stuff like this :( (it's not the nature of programming...).

 

Thanks for both of your replies, I suspect when I get home later today I will have bigger and deeper look at this (hopefully finding some kind of holy grail).

 

~Joe

Posted

Hi

 

There is an easy way to do this, it is called back face culling.  If you turn culling off, the game will render both sides of each face.  If you turn back face culling on, you will only see one of them.

 

        GL11.glCullFace(GL11.GL_BACK);

        GL11.glEnable(GL11.GL_CULL_FACE);

or

        GL11.glDisable(GL11.GL_CULL_FACE);

 

 

This guide to openGL is pretty good and has more details.

http://www.glprogramming.com/red/

 

This link talks a bit about the tessellator and the "sides" of faces if you turn back face culling on.

 

http://greyminecraftcoder.blogspot.com.au/2013/08/the-tessellator.html

 

-TGG

Posted

Hmm, I was thinking that backface culling wouldn't work if the front polygon is transparent -- normally in backface culling you use it for polygons that are fully not visible, but I guess you are right -- it will probably cull the back face anyway since that is usually determined simply by the direction considered the outside of the surface.  Basically in this particular case he wants an artifact that is usually undesirable.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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...

×   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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Reach Out To Rapid Digital: What sapp Info: +1 41 4 80 7 14 85 Email INFO: rap iddi gita lrecov ery @ exe cs. com Hello, my name is Jayson, and I’m 35 years old from the United Kingdom. My family and I recently endured an incredibly challenging experience that I wouldn’t wish on anyone. We became victims of a cryptocurrency investment fraud scheme that saw us lose a staggering $807,000 in USDT and Bitcoins. The fraudsters had created a convincing facade, and we were lured into investing, only to discover later that the platform was a complete scam. We were left devastated, not just financially, but emotionally, as we had trusted these people and believed in the legitimacy of the investment. After the initial shock wore off, we desperately searched for ways to recover the lost funds. It seemed like an impossible task, and we felt as though there was no hope. That’s when, by sheer luck, we stumbled across a post about Rapid Digital Recovery, a cryptocurrency and funds recovery organization with a proven track record in cybersecurity and fraud recovery. We decided to reach out to them, and from the first interaction, we were impressed with their professionalism and transparency. They explained the recovery process in detail and reassured us that they had the skills and expertise to track down the perpetrators and recover our funds. This gave us a renewed sense of hope, something we hadn’t felt in months. What truly stood out during our experience with Rapid Digital Recovery was their dedication to the recovery process. The team went above and beyond, using sophisticated tracking tools and cyber forensics to gather critical information. Within a matter of weeks, they had successfully located the funds and traced the scam back to the fraudsters responsible. They worked with the authorities to ensure the criminals were held accountable for their actions. To our relief, the team at Rapid Digital Recovery was able to recover every single penny we had lost. The funds were returned in full, and the sense of closure we felt was invaluable. We couldn’t have imagined such a positive outcome in the early stages of our recovery journey, and we are deeply grateful for the work they did. If you ever find yourself in a similar situation, I highly recommend contacting Rapid Digital Recovery. Their expertise, transparency, and dedication to their clients make them the go-to choice for anyone seeking to recover lost cryptocurrency or funds. They truly gave us back our financial future.  
    • This is my first time modding anything, so maybe just skill issue. I'm using Forge 54.0.12 and Temurin 21.0.5+11-LTS I wanted to create a custom keybind and to check whether it works I'd like to send a chat message. I tried using Minecraft.getInstance().player.sendSystemMessage(Component.literal("test")); but IntelliJ couldnt resolve sendSystemMessage(...). Since I saw people using it in earlier versions, I tried the same thing with 1.20.6(- 50.1.0), where it works fine, now I can't figure out if this is intentional and whether there are other options for sending chat messages. On that note, is there more documentation than https://docs.minecraftforge.net/en/1.21.x/? It seems very incomplete compared to something like the Oracle Java docs
    • Hi, i'm having this error and I wanna fix it. we try: -Reload drivers -Eliminate .minecraft -Eliminate Java -Restart launcher -Verify if minecraft is using gpu -Mods  in .minecraft is empty -Install the latest and recomended version of forge idk what i have to do, help me pls. the lastest log is: https://mclo.gs/WAMao8x  
    • Read the FAQ, Rule #2. (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/)  
  • Topics

×
×
  • Create New...

Important Information

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