#How to give 2d object color?
16 messages · Page 1 of 1 (latest)
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
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
Write shader code. Otherwise your approach won't be scalable.
I tried shadenode by visualshader, but the color doesn't change.... I even tried use expression but it doesn't work
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
It worked and this is the result
Well, now question who is owner of this script
What script? I copying what you instruct me to do
probably the scrpt you just made with the shader_type, uniform vec4, and all that stuff
Yeah but it's important who owns the script. I have slight difficulty to tell that looking at your hierarchy. You give it to Mesh2D. Is this mesh just a colored rectangle? If so, it works as intended.
Oh i give the script to MeshInstance 2D, by enabling its shader material