Glass Bell Render bug in inventory with special renderers
iTitus opened this issue · 21 comments
When you have a Glass Bell in your inventory, you open it, the glass bell has a black 'filling'.
But only if you have one of these in your inventory and you are not hovering it:
- Any item
- Stained glass pane
- Saplings
- Fluid Blocks
- Fire
- Your blocks with a model
-> Everything with a special renderer
I made a picture and a video:
I'm aware of the bug. I've attempted various fixes but I'm at a loss as to why this happens. I'm not a rendering guru so if anyone of you reading this are feel free to take a crack at this one
I've seen this happening with Buildcraft too. I'm not sure if you're to blame here pahimar!
I fixed this same issue in Refined Relocation and I'll PR a fix for it now :)
EDIT: that's a lot of people suddenly :P
Fixed something similar in BetterStorage with GL11.glEnable(GL11.GL_ALPHA_TEST);
Yes, @Victorious3 this is it. PR: #715
Hmm, to fix this I enabled GL_BLEND. Works too. Any idea on what is the 'better' fix? I'm not a rendering guru either.
Probably best to use the glAlphaFunc. That fixes rendering glitches like
these
On 22 Jul 2014 16:41, "Dynious" [email protected] wrote:
Hmm, to fix this I enabled GL_BLEND. Works too. Any idea on what is the
'better' fix? I'm not a rendering guru either.—
Reply to this email directly or view it on GitHub
#713 (comment)
.
If it doesn't need translucent alpha (i.e. it's either transparent or opaque and nothing in between) I'd use ALPHA_TEST. If it has partially-transparent pixels, use BLEND, but it doesn't look like this does.
Because blending is a thing in general: it can be alpha, multiplication and all the goodies of the fixed pipeline(in current MC case). Currently there is only alpha test leak in MC. It is bad practice to override whole context if it is not controlled, but I can be wrong :)
@Itaros That's a good explanation, thanks!
Blending and Alpha Testing are separate states. Blending is when there are pixels that are partially-transparent overlapping each other, and alpha testing means the renderer will test based on the binary transparent-or-opaque value of a texel before building the depth buffer.
@briman0094 Minecraft uses a fixed pipeline version of OpenGL. There are no shaders. That's why there using fixed pipeline commands (e.g. glPushMatrix(), glScalef(), etc.).
Well, technically GL_ALPHA_TEST isn't used anymore if I remember correctly. I think that's done in the shader. GL_BLEND might do something; I can't remember if the shader is supposed to handle all blending functions or not.
As for OGL 3.2 GL_BLEND is used to control application of A component from RGBA. Shaders nowadays define how to apply this blending: as cutout(like GL_ALPHA_TEST does in fixed pipeline) or as full-featured blending(from texture sampling).
I don't have any idea if it helps but minecraft itself had and apparently has again some weird behaviour when it comes to special renderers. The behaviour of the initial bug https://bugs.mojang.com/browse/MC-35617 is very similar to this one, and it was related to overlays like stack size display and enchantments. So even if this bug is solved for now I would think that it is more of a problem in Minecraft itself, as it apparently happens for other mods too.
Im not at all a graphics specialist, so it might very well be just a simple tricky behaviour in OpenGL that just happens to work most of the time. In my opinion, the bug seems indeed like Minecraft renders the inventory sequentially and some of the visible items set GL settings that may not be fitting for the following items, and that they never get reset because they assume each item will set its rendering settings as needed.
To further improve the fix that is already merged it might be useful to get the current setting before changing it and then only setting and resetting it when needed.
It's not exactly a bug...it is, but it's just on whoever wrote the item renderer. It's due to the fact that OpenGL is literally just a state machine, and they're not making sure they have the state they want before rendering.