Skip to content

Instantly share code, notes, and snippets.

@PopupAsylum
Created September 23, 2016 14:07
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 PopupAsylum/59d480bcb4e749ee2ef154c8551d0c19 to your computer and use it in GitHub Desktop.
Save PopupAsylum/59d480bcb4e749ee2ef154c8551d0c19 to your computer and use it in GitHub Desktop.
Returns 1 if 0<=x<1, 0 otherwise
//returns 1 if 0<=x<1, 0 otherwise
float IsBetween0And1(float x) {
return 1 - saturate(floor(abs((x-0.5)*2)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment