Basic visual shader basic start help

Godot Version

MacOS Liquid ‘ass | Godot 4.6.2

Question

I am trying to start learning about shaders but every tutorial and Godot docs show screenshots that are different to what I get when I follow these steps:

  • New project, new Node2D scene
  • Create a Sprite2D and assign Godot logo
  • Inspector / Material / new ShaderMaterial / New Shader… / Select VisualShader, Canvas Item
  • Add ColorConstant and plug into Output’s Color

Firstly, my Output node doesn’t have the same inputs as I see elsewhere. Secondly, when I plug in the ColorConstant:Gold and change colour, it’s blending rather than replacing the pixels of the sprite. This isn’t the behaviour I expected from watching tutorials and under Inspector / Shader there’s no option for “replace” or amount to “Mix”.

This is what I get:

This is the Output node I expected when creating a VisualShader, Canvas Item:

I assume I’m doing something wrong but I can’t figure out what.

Maybe you are in the “Vertex” shader function when you want to be in the “Fragment”? I prefer to write shaders as code so I am also unfamiliar with the interface, if you post the tutorials you are using maybe we could help more too.

1 Like

Switch to fragment function here:

2 Likes

Ah, thank you both! That was it and now it matches what I’m seeing.

I don’t know if the default mode for a new shader changed but I went back to two tutorials that show Fragment as being the mode just after creating a new shader without needing to change it. Being a noob on this topic, I didn’t realise or notice. I shall now go read up on wtf Fragment is.

If I could mark both your replies as the solution I would!