0 votes

I have a face sprite with sprites for eyes and a mouth inside. They're set in a hierarchy so that when the face moves, the face features move with it. When the face turns, I would like the eyes and mouth to not appear outside of the face's boundary. This could be accomplished with a mask, but it looks like Godot Engine doesn't have an easy masking feature.

I've searched online and some people suggested using a Light2D. This works for the most part, except for a few problems. It creates a thin outline at the edges of the mask, which appears above everything on the same layer. It also causes the sprites inside the Light2D to completely ignore other Light2D effects, so shadows and such don't affect the face.

This thread provided a nice example using shaders: https://github.com/godotengine/godot/issues/23763 When I try to use this shader myself, it completely wipes out the face. If I try to change some values around, it kinda looks like it provides an separate mask for each facial feature, instead of just one mask. I set each facial feature to inherit the parent's shader, so I guess that makes sense. But that's also not what I want.

I want a single mask affecting multiple sprites in a hierarchy, and I want the mask to be at a specific position. Is there another way to accomplish this?

in Engine by (113 points)
edited by

Working on the assumption that this is impossible, I'll just have to design my sprites without masking in mind. It'll take a little more work but it'll actually end up looking better in the end I think.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.