Jump to content

Recommended Posts

Posted

I made a mod to make colored glass, but I cannot figure out how to make it partially transparent. I know MCPatcher does this, but it only does it for actual glass. I looked at the code for ice (since it is partially transparent) but I cannot find anything in the block class or its material that sets it to be partially transparent.  I also tried searching these forums and Google, and could not find anything there either.

 

Does anybody have any idea how to do this? Or, failing that, get MCPatcher to apply its "better glass" mod to my new class?

Posted

Two bits:

 

There's a renderType function, which returns either a 0 or a 1 (compare glass and ice).  IIRC, blocks that use alpha return 0, and then have a partially transparent texture.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

There is a getRenderBlockPass function that returns 1 in BlockIce and 0 in BlockGlass. It has the comment " Returns which pass should this block be rendered on. 0 for solids and 1 for alpha" I tried overriding that function in my class so that it returned 1 as well, but it still isn't partially transparent. Is that the function you are talking about, or is there another one? I don't see one called renderType.

Posted

That's the one.

 

But you also have to make your texture transparent.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Also worth noting is that you will not be able to see anything that is also partially transparent (read: translucent) that is behind it. Ex: You won't be able to see water through your translucent block. If there's a solution to that problem, however, I am unaware of it, since Minecraft does not support extra rendering passes in any way that I'm aware of.

Posted

You're right, the problem is the textures. Somebody else made them for me (because they requested the colored glass mod in the first place) and I didn't even think to make sure they were done properly. After talking with the person that made them, they apparently assumed that it was taken care of in the code while I assumed they made the images transparent. I tested my class with the ice texture and it does work properly.

 

Thanks for the help.

Posted

Also worth noting is that you will not be able to see anything that is also partially transparent (read: translucent) that is behind it. Ex: You won't be able to see water through your translucent block. If there's a solution to that problem, however, I am unaware of it, since Minecraft does not support extra rendering passes in any way that I'm aware of.

 

There must be some way to do it, because the glass with MCPatcher's BetterGlass mod lets you see water and other glass through it perfectly. I can't see it them in mine, though. I wonder what they did to accomplish that. Anybody have any ideas? It does look pretty lame.

Posted

There must be some way to do it, because the glass with MCPatcher's BetterGlass mod lets you see water and other glass through it perfectly. I can't see it them in mine, though. I wonder what they did to accomplish that. Anybody have any ideas? It does look pretty lame.

 

I would not be surprised if they hacked in a third render pass.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

There must be some way to do it, because the glass with MCPatcher's BetterGlass mod lets you see water and other glass through it perfectly. I can't see it them in mine, though. I wonder what they did to accomplish that. Anybody have any ideas? It does look pretty lame.

 

I would not be surprised if they hacked in a third render pass.

 

Hmm, maybe. I noticed that I can see their glass through my glass, and their glass through their own glass. I wonder if they would tell me how to take advantage of whatever they did to make it work if I asked them.

Posted

For anybody who looks at this topic later trying to do the same thing, Draco18s is correct. MCPatcher does add an extra render pass (two of them, actually), and it is possible to take advantage of this through their connected textures mod.

 

For specifics from the author of MCPatcher, go to this link: http://www.minecraftforum.net/topic/1496369-151-147update-44-mcpatcher-hd-fix-303-01-245-04/, scroll down to "Information for Texture Pack Authors" and then scroll down to the section about Better Glass. You'll probably also have to read through the Connected Textures section as well, as setting that up is how you can take advantage of the extra rendering passes.

 

The description mentions that the translucent part gets rendered over by things like ice, but it's not true. My game renders both glass behind ice and ice behind glass just fine. You may have to play with the property files, but it looks like it's possible to implement fully functional translucent blocks beyond regular glass.

Posted

For anybody who looks at this topic later trying to do the same thing, Draco18s is correct.

 

width=485 height=270http://imgs.xkcd.com/comics/wisdom_of_the_ancients.png[/img]

 

Averted. :P

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Haha, that's why I added it. All the previous topics I had found on the subject had no answer on how to fix the problems, so hopefully now one will.

 

As a follow-up to my last post: I did get it to mostly work. You can't see the glass through ice and water, but you can see ice and water through the glass. (I was wrong when I posted before saying you can see the glass through ice. You can only see the frame, just like it says. It's just hard to tell because of the texture of ice.) Seeing glass through other glass is hit or miss, but it at least fixes the issue of looking out your window and seeing an empty hole where the ocean or a lake is supposed to be. I think that's as good as it's going to get with the current rendering engine in Minecraft.

Posted
I think that's as good as it's going to get with the current rendering engine in Minecraft.

 

Probably.

 

Alpha z-sorting is a bitch.  Which is why there are render passes, but it means that certain things don't render behind certain other things (like water behind ice, etc.) because without them, things go all screwy.

 

In googling for an image to use an example, the first result was from a thread I posted on the Unity forums about this very issue. :P

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

From what I can contribute:

The reason the no-dual-layer-transparency glitch (eg not seeing water through ice) is a bug in OpenGL (MC's rendering engine) itself - it cannot understand alpha in the traditional manner, so what it is essentially doing is recoloring areas accordingly as you add new render passes with semitransparent textures. Since it automatically also performs culling (not rendering things that are behind others and rendered at the same time, no matter what), that means having two semitransparent things on the same pass will cause only the latter one to be visible.

 

Also, does anyone know if Optifine adds extra render passes like MCPatcher?

 

Finally, yes, the render-on-both-passes trick works - I use it for my TileEntities which are partly transparent and partly opaque, and use "MinecraftForgeClient.getRenderPass() == 1" in the Render files (passing arguments into the Model class' renderAll(...)).

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



×
×
  • Create New...

Important Information

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