Godot: Masking is too complex

Created on 28 Mar 2019  路  3Comments  路  Source: godotengine/godot

Hi there, from time to time I want to use a mask for my sprites. Which is only possible with shaders or (mis)using the light2D node.

Every time I want to implement a mask, I have to crawl the whole web to get to a solution. One response is "Just write a shader" but honestly, it's not "just" write a shader. Its: I have to put more work than expected into a very common problem by writing a shader :)

On the other side is the light2D method where you can use the "mask" property, which does not work at all. You have to use the "mix" property and add a canvas material to the masked sprites.
This is more than unintuitive and makes me crasy cause of this feeled randomness of masking an area. You can see this in this example: https://godotengine.org/asset-library/asset/115

So this is a feature proposal for a Mask node.

The handling of that should be simple. One good way is the Item Cull Mask of the light2D. If it matches with another node, then the mask is applied. Also, would it be great if sprites and colored rects which are children of that Mask node are treated as the texture. So the mask ist more flexible.

It is realy unexpecting complex to mask some nodes in Godot. Or did I just miss the "Just drag that shape and its done" somewhere?^^

archived feature proposal rendering

Most helpful comment

I would go with just adding a "Mask" mode to all CanvasItem making them modulate things in the same Z, relative to parent. As I suggest in #29105

This way we could use Polygon2D, Sprites, Particles2D and even Line2D.

If we go for a "Mask2D" node this video can be a good reference

All 3 comments

Yeah something simple and easy to setup for masking 2D textures would be very useful. Such as electing to mask one sprite to another, so you could visually drag it around in the editor and visual the result immediately.

I bump into this often enough, and as you say, it is a chore every time. During which, I reflect often about the ease of masking operations in all the other software I use.

I would go with just adding a "Mask" mode to all CanvasItem making them modulate things in the same Z, relative to parent. As I suggest in #29105

This way we could use Polygon2D, Sprites, Particles2D and even Line2D.

If we go for a "Mask2D" node this video can be a good reference

Feature and improvement proposals for the Godot Engine are now being discussed and reviewed in a dedicated Godot Improvement Proposals (GIP) (godotengine/godot-proposals) issue tracker. The GIP tracker has a detailed issue template designed so that proposals include all the relevant information to start a productive discussion and help the community assess the validity of the proposal for the engine.

The main (godotengine/godot) tracker is now solely dedicated to bug reports and Pull Requests, enabling contributors to have a better focus on bug fixing work. Therefore, we are now closing all older feature proposals on the main issue tracker.

If you are interested in this feature proposal, please open a new proposal on the GIP tracker following the given issue template (after checking that it doesn't exist already). Be sure to reference this closed issue if it includes any relevant discussion (which you are also encouraged to summarize in the new proposal). Thanks in advance!

Was this page helpful?
0 / 5 - 0 ratings