I want to draw some very-semi-transparent objects on top of my scene and have them blend nicely with the other pixels in the scene, but not blend with the background; if I draw a semi-transparent object over the (black) background, I don’t want it tainted and drawn dark.
The top scene is what I get – the semi-transparent orange triangle on top is blended with the black background. The bottom scene is what I want – the semi-transparent orange triangle is blended only with the blue triangle, but not with the black background.
How can this best be achieved? Is there a simple blend func that does this? I would like to avoid deferred rendering and such if I possibly can.
Is there some way that gl.blendFunc
and perhaps gl.blendFuncSeparate
can be used to achieve this?