Created
June 12, 2015 05:32
-
-
Save eddietree/29efa7397f45bafc8e88 to your computer and use it in GitHub Desktop.
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
// input that you pass in, however unity does it | |
uniform vec2 uvTouchPos; | |
uniform float circleRadius; | |
// the fragment shader basically tells the GPU what to color that exact pixel on screen | |
// the UV is what texture coordinate you are looking at | |
vec4 FragColor( vec2 uv ) | |
{ | |
// find out how far you are from touch | |
float distanceToTouch = length( uv - uvTouchPos ); | |
// is inside, color black | |
if ( distanceToTouch < circleRadius ) | |
return vec4(0,0,0,1); | |
// else color white | |
return vec4(1,1,1,1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment