Created
April 8, 2017 11:10
-
-
Save ivcn/e17b9cbf758fa587b91ba0c748b5bad8 to your computer and use it in GitHub Desktop.
simple 2D 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
| void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
| { | |
| vec2 center = iResolution.xy / 2.0; | |
| float r1 = iResolution.y / 5.0; | |
| float r2 = iResolution.y / 3.0; | |
| vec2 uv = fragCoord.xy / iResolution.xy; | |
| float dist = distance(fragCoord.xy, center); | |
| if( dist >= r1 && dist <= r2) { | |
| float d = (dist-r1)/(r2-r1); | |
| fragColor = vec4(d, 1.0-d, 0.5+0.5*sin(iGlobalTime), 1); | |
| } | |
| else | |
| fragColor = vec4(uv,0.5+0.5*cos(iGlobalTime),1.0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment