Hi, I’ve faced a problem working with effect composers.
Here’s the fiddle: https://jsfiddle.net/lutymane/vtjq0ms8/58/
So I use UnrealBloomPass with a ShaderPass after to manipulate opacity of the final scene.
And I’ve stumbled across a strange behavior - when you manipulate alpha channel in the shader, visually it only changes opacity for black pixels (and shades as you can see the glow on the left), while colored pixels seem to preserve their opacity (which visually seems to be around 1.0). Even if you set alpha in the shader constantly to 0.0, visually it again only removes the black background (which is present after applying unreal bloom pass) and keeps the circle
Investigating further, i tried to draw the composer scene on a quad as a texture (right part in preview) and this correctly handles alpha channel, BUT the colors don’t look as good as on the right, it’s too dim, i know though it’s an expected behavior.
Experimenting further, if you set
blending: NoBlending for rendering quad, the colors look great, but again we lose alpha channel (basically it looks just like the left half), which is kinda(?) expected again.
If you set
transparency: true for ShaderMaterial in ShaderPass then you get image on the left half look the same like on the right (bad colors but with transparency)
I can’t simply leave it as it is on the left half, because I will need to draw another composer and it will just overwrite the previous image, because even though it’s got “transparent” pixels, there’s smth wrong with blending. And setting
transparency: true is not an option again, because the colors don’t look as needed.
So the questions:
- What’s up with the alpha channel, why does it affect only black pixels on the left half?
- How do I get the best out of both? Decent colors from the left and alpha channel manipulation from the right?