Vertex color is ignored when rendering
This is a bit of a technical question, but it has come to my attention that a rendering thing I do in my mod does not work when Iris is installed. I am rendering a texture overlay over the entire screen using the position, color, texture shader with the color of each vertex of the quad being
1, 0, 0, 0.33
, but this color is completely ignored when Iris is installed. Without Iris, it renders the overlay translucent red as expected, but with Iris, it renders it as if the colour was white with an alpha of 1.
The version of Minecraft I use is 1.19.2 and of Iris is 1.6.4.
Is there anyone who could shed some light on this issue and tell me why it happens and preferably also how I can fix it?10 Replies
this is a question for @IMS
This is the source btw: https://gist.github.com/PlanetTeamSpeakk/ab6f0818387c7ee2b0ce5502b2bee11b
is it with iris, or with shaders?
Just Iris. No shaders installed.
my best guess is it's this screwing up
consumers.draw(TexturedRenderLayers.getEntitySolid());
consumers.draw(TexturedRenderLayers.getEntityCutout());
you can't draw a specific layer when iris is installed, as it uses a custom batching system
Making the overlay translucent red happens when the framebuffer's texture is drawn at the very end. The entities render just fine, they're just not translucent red as it seems that the color when drawing the quad is ignored.
Just tried making a mixin that overrides the shader color in RenderSystem, but that had no effect either.
Although, it could also be that Iris breaks the separate framebuffer meaning that the entities are drawn directly to the main framebuffer? That'd explain it.
Yeah, think that's what's going on cuz I also cannot see the entities through blocks which I am supposed to be able to.
@IMS would using GlFramebuffer from Iris fix this issue?
iris shouldn't replace framebuffers, no
GlFramebuffer is just a wrapper
Hmm, idk. It definitely seems that Iris is breaking my framebuffer for whatever reason. Another mod author I work with said earlier that using your own framebuffers never works with Iris.
what Iris does do is prevent other mods from writing to the main framebuffer
it explicitly allows rendering to a mods' own framebuffer
as a solution
I just did some testing and it seems that the framebuffer is bound (the value of
GL_DRAW_FRAMEBUFFER_BINDING
changes), but even if I remove the code that draws the framebuffer to the main buffer, whatever is drawn on it still appears on the screen even though it shouldn't cuz it's pretty much in limbo.
So from that I conclude there's something in Iris that either draws the content of my framebuffer to the screen for me or overrides the bound framebuffer.
I am guessing it's the latter.
Doesn't seem like it was the latter btw. It binds just fine and even after the drawing, it is very much still bound. So that leaves the former, but that kinds seems like weird behaviour to me.