Skip to content

Instantly share code, notes, and snippets.

@danbee
Created June 22, 2020 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danbee/ab8c1e91fc4e3568fa1ecbd1594da5eb to your computer and use it in GitHub Desktop.
Save danbee/ab8c1e91fc4e3568fa1ecbd1594da5eb to your computer and use it in GitHub Desktop.
Some GLSL shader functions
vec3 square(vec2 st,vec2 bli,vec2 tri,vec3 color) {
// bottom-left
vec2 bl = step(bli,st);
// top-right
vec2 tr = step(1.0-tri,1.0-st);
float pct = bl.x * bl.y * tr.x * tr.y;
vec3 c = vec3(pct * color);
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment