Skip to content

Instantly share code, notes, and snippets.

@eddietree
Created June 12, 2015 05:32
Show Gist options
  • Save eddietree/29efa7397f45bafc8e88 to your computer and use it in GitHub Desktop.
Save eddietree/29efa7397f45bafc8e88 to your computer and use it in GitHub Desktop.
// 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