-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Godot version
v4.1.stable.mono.official [970459615]
System information
Windows 11, Forward+, Nvidia GTX 4080, driver version 537.58
Issue description
The documentation for CanvasItem fragment shaders states:
Certain Nodes (for example, Sprite2Ds) display a texture by default. However, when a custom fragment function is attached to these nodes, the texture lookup needs to be done manually. Godot does not provide the texture color in the COLOR built-in variable; to read the texture color for such nodes, use ...
However both the visual and the text based shader allow multiplying the COLOR variable with some other color and getting the correct result without a texture lookup.
So either the documentation is no longer up-to-date or the engine is behaving differently from what is documented. I cannot say which is the intended behaviour.
Steps to reproduce
Make a Sprite2D from the default icon by dragging the icon into the scene view. Then assign a shader with this code to its material:
shader_type canvas_item;
void fragment() {
COLOR.rgb = COLOR.rgb * vec3(1.0,0.0,0.0);
}The result will be a red-tinted default icon, while according to the documentation it should not be since we never do a texture lookup in the shader.
