-
-
Save dmaz/f667f914c2f2f0ddfbf4face5f6cdcf1 to your computer and use it in GitHub Desktop.
Simple godot shader
This file contains hidden or 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; | |
| uniform vec4 col : hint_color; | |
| uniform float eff_str = 0.8; | |
| float rand(float x){ | |
| return fract(cos(x) * 2345.6789); | |
| } | |
| float triangle(float x){ | |
| return abs(1.0 - mod(abs(x), 2.0)) * 2.0 - 1.0; | |
| } | |
| void fragment() | |
| { | |
| float time = floor( TIME * 12.0) / 4.0; | |
| vec2 uv = SCREEN_UV; | |
| vec2 p = uv; | |
| p += vec2(triangle(p.y * rand(time) * 4.0) * rand(time * 1.9) * 0.013, | |
| triangle(p.x * rand(time * 3.2) * 4.0) * rand(time * 2.1) * 0.013) * eff_str; | |
| p += vec2(rand(p.x * 3.2 + p.y * 7.9) * 0.01, | |
| rand(p.x * 1.1 + p.y * 6.7) * 0.01) *eff_str; | |
| vec4 baseColor = vec4(texture(SCREEN_TEXTURE, uv).rgb,1.); | |
| vec4 edges = 1.0 - (baseColor / vec4(texture(SCREEN_TEXTURE,p).rgb, 1.)); | |
| float l = clamp(length(edges), 0., 1.5); | |
| COLOR.rgb = vec3(col.rgb * l); | |
| COLOR.a = l * 0.6 * col.a; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment