Radial Rainbow

Adds a radial rainbow tint to a texture 

Uniforms:
Influence: How strong the tint is

Offset: The angle offset (in degrees)

Shader code
shader_type canvas_item;

// --- Uniforms --- /
uniform float influence: hint_range(0.0, 1.0, 0.1) = 0.5;
uniform float offset: hint_range(0.0, 360.0, 1.0);

const float TWO_PI = 6.28318530718;

// --- Functions --- //
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() {
	vec2 pos = vec2(0.5) - UV;
	COLOR.rgb += influence * hsv2rgb(vec3(((atan(pos.y, pos.x) + radians(offset)) / TWO_PI) + 0.5, length(pos) * 2.0, 1.0));
}
Tags
rainbow, rainbow radial, rgb
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 KingToot

Radar Blip Ring

Pixelize

Sine Morphing

Related shaders

Linear Rainbow

Circle Rainbow

Simple Rainbow

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments