#How to give 2d object color?

16 messages · Page 1 of 1 (latest)

vale drift
#

I have object in 2d which is node 2d, that I want to give it a color, but I don't know how

mint axle
#

you can add a sprite node and give that one a colour? Or add a textureRect or something like that. A node2d can't have any color as far as I'm aware

vale drift
#

I found the solution, you must change the Modulate property of node2d (well, in my case I use Mesh Instance 2d) under Visibility tab so the object will change its color to whatever you want

#

Thank you for telling me about Sprite 2d

small rover
vale drift
#

I tried shadenode by visualshader, but the color doesn't change.... I even tried use expression but it doesn't work

small rover
#

I don't know what shadenode is.

#

Material -> new ShaderMaterial -> Shader ->

shader_type canvas_item;

uniform vec4 color : source_color;

void fragment() {
      COLOR.rgb = color.rgb;
}
#

One color, without affecting transparency

#

If you want to change transparency, add a at the end of rgb

vale drift
#

It worked and this is the result

small rover
vale drift
#

What script? I copying what you instruct me to do

mint axle
#

probably the scrpt you just made with the shader_type, uniform vec4, and all that stuff

small rover
vale drift
#

Oh i give the script to MeshInstance 2D, by enabling its shader material