I can't get alpha blending to work. #2606
HumanGamer
started this conversation in
General
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've been trying for many hours to get alpha blending to work.
So I made a new application to see if it was something wrong elsewhere in my project but I'm still getting the same issue.
My code is here: https://github.com/HumanGamer/game_engine_test
Both shapes have alpha of 0x55 and the state is set with:
bgfx::setState(BGFX_STATE_DEFAULT | BGFX_STATE_BLEND_ALPHA);
They appear as follows:
The colors should blend where they overlap but it's not working.
I tried many many different blend states and none of them cause the blending to work. I also looked at example-19-oit but couldn't get it to work. I tried doing the
color.xyz *= color.w
thing in the shader but that didn't work either.I tested with OGL, Vulkan, and DX11 on Windows, and OGL and Vulkan on linux, they all have the same issue.
I'm not sure but this could be a bug in bgfx. Although example-19-oit appears correctly as far as I can tell.
What am I missing? I just can't figure out why it's not working.
PS: if you compile my project linked above, the shader won't compile. I copied it out of the original project I was testing this with. I did include the code though, but you'll have to compile it yourself if you need to edit it. Also working directory needs to be set to the root of the repo for the app to find the shaders.
Oh and also I should mention I'm new to graphics programming, however I asked some friends who know DirectX and OpenGL and they all looked at my code and said that as far as they can tell, it should be working.
Beta Was this translation helpful? Give feedback.
All reactions