Chat GPT – Spatial Rainbow Gradient

Spatial adaptation of Exuin’s Rainbow Gradient Shader entirely modified by Chat GPT

Original Shader by Exuin : https://godotshaders.com/shader/moving-rainbow-gradient/

Shader code
shader_type spatial;

const float PI = 3.1415926535;

uniform float strength: hint_range(0., 1.) = 0.5;
uniform float speed: hint_range(0., 10.) = 0.5;
uniform float angle: hint_range(0., 360.) = 0.;

void vertex() {
    // Pas de modification nécessaire dans la partie vertex du shader
}

void fragment() {
    float hue = UV.x * cos(radians(angle)) - UV.y * sin(radians(angle));
    hue = fract(hue + fract(TIME * speed));
    float x = 1. - abs(mod(hue / (1./ 6.), 2.) - 1.);
    vec3 rainbow;
    if (hue < 1./6.) {
        rainbow = vec3(1., x, 0.);
    } else if (hue < 1./3.) {
        rainbow = vec3(x, 1., 0);
    } else if (hue < 0.5) {
        rainbow = vec3(0, 1., x);
    } else if (hue < 2./3.) {
        rainbow = vec3(0., x, 1.);
    } else if (hue < 5./6.) {
        rainbow = vec3(x, 0., 1.);
    } else {
        rainbow = vec3(1., 0., x);
    }
    vec2 modifiedUV = vec2(UV.x, 1.0 + UV.y); // Inversion de l'axe Y
    vec4 color = texture(SCREEN_TEXTURE, modifiedUV);
    ALBEDO = mix(color.rgb, rainbow, strength);
    ALPHA = color.a;
}
Live Preview
Tags
rainbow
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 Le Goss du Net

Related shaders

guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
anon
anon
2 days ago

eww ai