Created
June 16, 2019 08:34
-
-
Save jimmyjonezz/d36ff69aa70c6928ff97d3eb5a6f6887 to your computer and use it in GitHub Desktop.
Godot 3.1: https://github.com/HGRussian/godot_shaders/tree/master/EM_interference_effect (@Timofffee)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
float rng2(vec2 seed, float TIME) | |
{ | |
return fract(sin(dot(seed * floor(TIME * 12.0), vec2(127.1,311.7))) * 48654.5453123); | |
} | |
float rng(float seed, float TIME) | |
{ | |
return rng2(vec2(seed, 1.0), TIME); | |
} | |
void fragment() | |
{ | |
vec2 uv = SCREEN_UV; | |
vec2 blockS = floor(uv * vec2(24.0, 9.0)); | |
vec2 blockL = floor(uv * vec2(8.0, 4.0)); | |
float r = rng2(uv, TIME); | |
vec3 noise = (vec3(r, 1.0 - r, r / 2.0 + 0.5)* 1.0) * 0.08; | |
float lineNoise = pow(rng2(blockS, TIME), 8.0) * pow(rng2(blockL, TIME), 3.0) - pow(rng(7.2341, TIME), 17.0) * 2.0; | |
vec4 col1 = texture(SCREEN_TEXTURE, uv); | |
vec4 col2 = texture(SCREEN_TEXTURE, SCREEN_UV + vec2(lineNoise * 0.05 * rng(5.0, TIME), 0.0)); | |
vec4 col3 = texture(SCREEN_TEXTURE, SCREEN_UV - vec2(lineNoise * 0.05 * rng(31.0, TIME), 0.0)); | |
COLOR.rgb = vec3(col1.x, col2.y, col3.z) + noise; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment