Hi everyone, I need your help with glsl postprocess.
I can’t manage to make the alpha channel work in my project like in this playground.
I tried everything to be as close as possible to the playground in my project but no matter what I do, I never had alpha transparency and instead a full blue image.
I even put the same engine options as in the playground to make sure everything stays the same.
preserveDrawingBuffer: true,
stencil: true,
I start to wonder if I am missing a specific file as I use the ES6 packages?
Or do you have any idea what could cause this?
I made new modifications and now I can’t be closer to the playground. I only create a canvas element, put it in the body, build the engine, and then it is a copy/paste of the playground code.
I managed to get it to work on the computer, but on my iPhone, unlike the playground, it stays all blue.
I noticed something that could be related to my issue.
If you put a black background, the color stays the same no matter what value you put in the alpha channel. I would expect it to be darker as it does go lighter with a white background.
After some further tests, I confirm that my issue is related to the fact that when the background is black, the alpha stops working like in the playground. The more it is black the less it works and the more it is white the better it works.
I tried to play with clearColor and fogColor but I still have the same issue when the parent background is black.
Now it does work except if you open the playground on an iPhone. You still have this weird behavior where it works with a white background but not a black one. I don’t see any error in the console.
How can we debug a thing like that?
I ended up following the alpha value to change the shader color with clearColor so as not to depend on the transparency of the canvas and to make sure it worked everywhere.