Node2D.clip_children strangely replicating content from elsewhere on the screen

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AndyAstrand

So I have a 2D+3D scene, with the 2D providing a HUD. Although I have seen this behaviour before on a purely 2D scene.

I have a profile at the top of the screen, avatar face in a round frame. In order to clip the avatar face to the round frame I’m using a extra node which is the parent of the face, with a texture from a PNG in order to mask it’s child, and the have the clip_children option set true.

It does work. The avatars face is clipped to the circle. But instead of seeing the black background behind the face/mask provided by another Node2D behind. I’m instead seeing a chunk of the 3d part of the screen, shrunk and moved and displayed their instead. It even changes and updates as the rest of the screen is animated.

It’s an interesting effect, but not one that I’m after. And I can’t see that I’m doing anything wrong. Example below:

The code adding the nodes is very simple:

var bg = Sprite2D.new()
bg.texture = _frame_bg
bg.name = "FrameBG"
self.add_child(bg)

var m = Sprite2D.new()
m.texture = _avatar_mask
m.name = "AvatarMask"
m.clip_children = true
self.add_child(m)

var a = Sprite2D.new()
a.texture = _avatar_image
a.name = "AvatarSprite"
m.add_child(a)

var g = Sprite2D.new()
g.texture = _frame_glass
g.name = "GlassSprite"
self.add_child(g)

var f = Sprite2D.new()
f.texture = _frame_image
f.name = "FrameSprite"
self.add_child(f)

Edited to fix forum code formatting…

jgodfrey | 2023-06-27 19:39

:bust_in_silhouette: Reply From: AndyAstrand

This seems to be a known bug and open as of April 15th.

I shall relax about it for now.