Rainbow Flow(canvasitem)

Shader code
shader_type canvas_item;

vec3 hsv2rgb(vec3 c)
{
    vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
    vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
    return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
}

void fragment() {
	COLOR = texture(TEXTURE, UV);
	float hue = (UV.x+UV.y) * 0.25 + mod(TIME * 0.5, 1.0);
	//float hue = -UV.y * 0.25 + mod(TIME * 0.25, 1.0);
	COLOR.rgb *= hsv2rgb(vec3(hue,0.6, 1.0));
}
Live Preview
Tags
2d shader, canvas_item, flow, godot 4
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from muzi1983

Related shaders

guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
3285593653@qq.com
3285593653@qq.com
21 days ago

好用