Skip to content

Instantly share code, notes, and snippets.

@jimmyjonezz
Created April 26, 2020 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimmyjonezz/2012e33b54a6e2689155f8ab3e107537 to your computer and use it in GitHub Desktop.
Save jimmyjonezz/2012e33b54a6e2689155f8ab3e107537 to your computer and use it in GitHub Desktop.
shader_type canvas_item;
uniform sampler2D noise_tex;
// set the colors in shader params
uniform vec4 color_blend : hint_color;
uniform vec4 color_blend_2 : hint_color;
uniform float PI = 3.1415;
void fragment(){
vec2 move = vec2(sin(TIME + UV.y * PI) * 0.001, TIME * 0.01);
// remove \"move\" if needed, it scrolls the noise up
vec4 noise = texture(noise_tex, UV + move);
// noise is white so any channel works fine
noise.r = pow(noise.r, 3);
// I used NoiseTexture of 512x512
// see the params for noise there
float t = smoothstep(0.04, 0.3, noise.r);
float t_2 = smoothstep(0.01, 0.2, noise.r);
float angle = PI/2. + (noise.r + TIME * 0.1) * PI;
vec2 dir = vec2(cos(angle), sin(angle));
vec4 col = texture(TEXTURE, UV + dir * 0.04 * t);
vec4 col_base = texture(TEXTURE, UV);
col.rgb = color_blend.rgb;
// optional lightening
// col.rgb += pow(t, 7) * 0.5;
col_base.rgb = color_blend_2.rgb;
// optional lightening
col_base.rgb += 0.2;
// optional darkening
// col.rgb *= clamp(t_2 - 0.2, 0, 1.);
float d = dot(col, col_base);
// a bit more pronounced edges
// COLOR = mix(col_2, col , t);
COLOR = mix(col_base, col , t_2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment