Closed curioustorvald closed 5 years ago
It seems the tiling shader (or something else) is just overwriting the window when each layer is drawn.
Currently the render now accepts FBO as an input, and that FBO is the one that the terrain is being drawn. Should be easy right? Blend terrain (a thing drawing now) over the wall (what's on the FBO). But can't get it to work, either my assumption is wrong or I missed a tiny little part, or use multiple FBOs which I want to avoid.
Come and think of it, Torches and Clear Glasses (completely transparent) work, but regular Glass (semitransparent) won't? WTF?
It must be fboRGB_lightMixed.inAction
part that something is wrong as using separate FBO for wall and terrain made the same result.
fboRGB itself is okay. Download TGA extract • Pastebin Base64 (filetype: gz)
Edit: NO it isn't; look at the alpha channel, it should contain no semitransparency but this one does.
Adding more test set FBO and screenshot ZIP • Pastebin Base64 (filetype: pkzip)
As you can see, alpha channel is not quite right, as if something went wrong in the blending.
Unrelated note: the rim of the Clear Glass is wrong, I should've not put the transparency on the reflection.
Gdx.gl.glBlendEquationSeparate(GL20.GL_FUNC_ADD, GL30.GL_MAX)
seems to do the trick, but now Crude Glass look like a sunscreen glass when placed against the open air. Also, use GL30 just for this? It kinda works but not optimal...
Edit: No, it doesn't do a trick.
the separated equation AND setBlendFunctionSeparate(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA, GL20.GL_SRC_ALPHA, GL20.GL_ONE)
seems work? (requires newest GDX nightly 20190112)
Then what about alpha premul?
Answer: still need to be premultiplied
now it works without BlendEquationSeparate? What the hell man.
In summary: Using batch.setBlendFunctionSeparate seems to done a trick, and it requires latest GDX build. I'm closing the issue now but if any unintended behaviour occurs, please re-open.
It seems when nontransparent (blockprop-wise) tile is drawn, the wall is not being drawn, or GL mixing is not working there.