bbc / VideoContext

An experimental HTML5 & WebGL video composition and rendering API.
http://bbc.github.io/VideoContext/
Apache License 2.0
1.33k stars 157 forks source link

Bugfix for alpha blending #126

Closed Sacharified closed 5 years ago

Sacharified commented 5 years ago

Fixes #125

Please see the issue above for details on the bug.

This PR changes the blending function of the WebGL context used when rendering the output of Effect and Compositor Nodes. This change eliminates the black discolouration seen previously. The discolouration occurred because the blending function set by the destination node would cause any images with transparency to blended with the context's background, in this case, solid black. The changes to the effect node's blend function causes its input to be blended with transparency instead of the context's background. The same has been done for compositing nodes, but we also need to account for cases where multiple translucent sources connected to a single compositor node.

PTaylour commented 5 years ago

great stuff, thanks @Sacharified

Shall I hold off merging this as

The same has been done for compositing nodes, but we also need to account for cases where multiple translucent sources connected to a single compositor node

Sacharified commented 5 years ago

Hey @PTaylour,

I'm not 100% sure that this fixes all cases for compositor nodes yet. I will open a new PR with just the changes to effect nodes for now.