Last active
December 5, 2016 18:43
-
-
Save patriciogonzalezvivo/9695e787d604ecc14569ddd461e9f65b to your computer and use it in GitHub Desktop.
Multistep functions
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
```glsl | |
float mix4smoothstep(float a, float b, float c, float d, float x ) { | |
return mix(mix(a,b,smoothstep(0.,.33,x)), | |
mix(b, | |
mix(c,d,smoothstep(.66,.99,x)), | |
smoothstep(.33,.66,x)), | |
step(.33,x)); | |
} | |
float mix4linear(float a, float b, float c, float d, float x ) { | |
return mix(mix(a,b,clamp(x,0.,.33)*3.), | |
mix(b, | |
mix(c,d,(clamp(x,.66,1.)-.66)*3.), | |
(clamp(x,.33,.66)-.33)*3.), | |
step(0.33,x)); | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment