Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | spotlessapple |
In the official documentation, shaders are introduced by reassigning COLOR inside a fragment function:
void fragment() {
COLOR = some_color;
}
In attempting to do this on a custom spatial shader, I receive the following error:
error: Constants can not be modified
The code I’m attempting to run is below:
shader_type spatial;
void fragment() {
COLOR = vec4(UV.x, 1.0 - UV.y, 0.5, 1.0);
}
Is this the expected behavior? Other tutorials in Godot shaders I’ve found also introduce the topic by reassigning color, so I can’t help but think I have something set funny or am misunderstanding something. Thanks in advance for any help!