godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 94 forks source link

Grant access to vertex colors for 9-patch rects, text, and other control types. #5376

Open DarkDruid216 opened 2 years ago

DarkDruid216 commented 2 years ago

Describe the project you are working on

I’m working on a turn based tactical role playing game. Colors’re are really important as it describes the player and what team they’re on. Includes even gradients, as well.

Describe the problem or limitation you are having in your project

Color choice is limited. For canvas items, the input node in Godot’s visual shader seems to imply you can use, like, two colors for each one CI, color and modulate, but something like 9-patch rect gives you access to only 1 of them, modulate, and not both fields.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Easy, add in color for all canvas nodes, even text, perhaps? I can not just add in player color, but also team color because of it. Besides, other people can benefit from more color choices. Perhaps four extra if rects are in fact quads with four vertices? Imagine the possibilities. Same goes for text and its outline color, especially changing even that in BC code.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

New public color… color Run the operation that draws the rect with both color and modulate. The rest is done via shaders, like mixing color and modulate from a grayscale and fetching the result of it.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I mean, maybe with a new material for each instance or an extra node as a child, but you have to see how inefficient this is doing this for every instance, right?

Is there a reason why this should be core and not an add-on in the asset library?

Because it is a core issue. You got to be a tech wizard to find out how to gain access to color and not just modulate.

Calinou commented 2 years ago

Related to https://github.com/godotengine/godot-proposals/issues/2564.

You can already draw text with gradient color using a shader, as mentioned in the proposal I linked.