You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[4.0.0-rc.5] Blend mode applied to masked sibling #7201
This was a tricky one. It required some digging into the render system. (I'm sorry, not a great issue for beginners, unless you're keen on doing that digging too!)
It turns out there was a longstanding issue with the Container rendering code. Containers can have a blend mode of SKIP_CHECK, which lets their children set the blend mode. Ordinarily, a second child will set its own blend mode. But if that child is also a Container with SKIP_CHECK, it will just carry on with whatever the last object's blend mode was. Again, ordinarily, the second container's children will set their own blend modes, and everything will be fine.
But when there's a filter or mask involved, an extra step is added, and it uses the blend mode from above. So the dangling blend mode from the outer Container is used to blend the results of the mask. All the internal parts of the inner Container are rendered correctly, but they are then composited with that erroneous ADD mode.
I've changed the logic to be more explicit about setting a blend mode in the Container. It now tracks a base drawing context, which it can fall back to if it can't find a definite blend mode. This resolves the issue, and will be in the next release.
Activity
imsarang commentedon Oct 19, 2025
Hi, I want to contribute to this project. Can you tell me which file needs to be changed, or should i just do the changes in the example code above
Fix ContainerWebGLRenderer passing incorrect blend modes to children.
BenjaminDRichards commentedon Dec 19, 2025
This was a tricky one. It required some digging into the render system. (I'm sorry, not a great issue for beginners, unless you're keen on doing that digging too!)
It turns out there was a longstanding issue with the Container rendering code. Containers can have a blend mode of
SKIP_CHECK, which lets their children set the blend mode. Ordinarily, a second child will set its own blend mode. But if that child is also a Container withSKIP_CHECK, it will just carry on with whatever the last object's blend mode was. Again, ordinarily, the second container's children will set their own blend modes, and everything will be fine.But when there's a filter or mask involved, an extra step is added, and it uses the blend mode from above. So the dangling blend mode from the outer Container is used to blend the results of the mask. All the internal parts of the inner Container are rendered correctly, but they are then composited with that erroneous
ADDmode.I've changed the logic to be more explicit about setting a blend mode in the Container. It now tracks a base drawing context, which it can fall back to if it can't find a definite blend mode. This resolves the issue, and will be in the next release.
Fix blend modes being applied to siblings in Container.