Skip to content

Instantly share code, notes, and snippets.

@pyalot
Last active August 29, 2015 14:11
Show Gist options
  • Save pyalot/ea8fefbad620f2435729 to your computer and use it in GitHub Desktop.
Save pyalot/ea8fefbad620f2435729 to your computer and use it in GitHub Desktop.
vec2 pack16(float value){
float f = clamp(value, 0.0, 1.0)*255.0;
float digitLow = fract(f);
float digitHigh = floor(f)/255.0;
return vec2(digitHigh, digitLow);
}
float unpack16(vec2 value){
return value.x+value.y/255.0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment