Created
August 17, 2019 18:18
-
-
Save jimmyjonezz/433c1a11432d2b2795f85f8edef38191 to your computer and use it in GitHub Desktop.
red + nois shader
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, vec2(lineNoise * 0.05 * rng(5.0, TIME), 0.0)); | |
vec4 col3 = texture(SCREEN_TEXTURE, 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