Last active
April 17, 2017 16:49
-
-
Save csaez/f41f3c66f16f5c5f451879566a1fd6d4 to your computer and use it in GitHub Desktop.
Stupid smiley face shadertoy 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
float circle(vec2 uv, vec2 p, float r, float blur) | |
{ | |
return smoothstep( r, r-blur, length(uv - p) ); | |
} | |
void mainImage( out vec4 fragColor, in vec2 fragCoord ) | |
{ | |
vec2 uv = ( fragCoord.xy / iResolution.xy ) - .5f; | |
vec2 pos = ( iMouse.xy / iResolution.xy ) - .5f; | |
float ratio = iResolution.x/iResolution.y; | |
uv.x *= ratio; | |
pos.x *= ratio; | |
float mask = circle(uv, pos, .4f, .01f); | |
mask -= circle(uv, pos + vec2(.15f, .1f), .09f, .01f); | |
mask -= circle(uv, pos + vec2(-.15f, .1f), .09f, .01f); | |
float mouth = circle(uv, pos, .3f, .01f); | |
mouth -= circle(uv, pos + vec2(0.f, 0.1f), .3f, .01f); | |
mouth = clamp(mouth, 0.f, 1.f); | |
mask -= mouth; | |
const vec3 color = vec3(1.f, 1.f, 0.f); | |
fragColor = vec4(mask * color, 1.0f); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment