Use volume light scattering post-processing clearColor alpha failure

this page:
test | Babylon.js Playground (babylonjs.com)
Is this necessary for volume light scattering post-processing?

In VolumtricLightScattering final Pass, its gl_FragColor.alpha is always more than 1., it’s not influenced by realColor.a which is clear by scene.

You should do like Fix PG, change the FinalPass shader. replace 1. with realColor.a. It seems some bug when scene.clearColor is not Color4(0,0,0,0), I set it all to zero. The canvas is transparency now.

When scene.clearColor is not all 0, it looks like that web blend rgb of canvas and backGround? Like clearColor.g = 1., mixColor is not correct any more. I am not clear about it. To fix this question , we should look forward to reply from @Evgeni_Popov or others.

That’s enough for me, thank you very much!

It seems to work for me. Whatever the color you set for r/g/b, if you set a=0, you will only get the color of the element which is “behind” the canvas. You should set something like a=0.2 if you want to mix the clear color with the canvas color.

Note that we will accept a PR that would preserve the alpha value from realColor. To avoid a breaking, it should be enabled through a property like preserveSourceAlpha, or something like that.

2 Likes