Basic Shimmer
Change th hue on the fly when a canvas item is drawn.
Shader code
shader_type canvas_item;
// A Shimmer's colours: every pixel takes the species' shimmer hue and saturation and keeps its own
// brightness and alpha.
// amount 0 leaves the art as it is. white fades the result to white (the evolution flash).
uniform float hue : hint_range(0.0, 1.0) = 0.0;
uniform float sat : hint_range(0.0, 1.0) = 0.0;
uniform float amount : hint_range(0.0, 1.0) = 1.0;
uniform float white : hint_range(0.0, 1.0) = 0.0;
varying vec4 tint;
vec3 hsv2rgb(vec3 c) {
vec3 p = abs(fract(c.xxx + vec3(0.0, 2.0 / 3.0, 1.0 / 3.0)) * 6.0 - 3.0);
return c.z * mix(vec3(1.0), clamp(p - 1.0, 0.0, 1.0), c.y);
}
void vertex() {
tint = COLOR;
}
void fragment() {
vec4 t = texture(TEXTURE, UV);
float v = max(t.r, max(t.g, t.b));
vec3 rgb = mix(t.rgb, hsv2rgb(vec3(hue, sat, v)), amount);
rgb = mix(rgb, vec3(1.0), white);
COLOR = vec4(rgb, t.a) * tint;
}

Comments 0
No comments yet.