I have found code, which packs float value into RGBA texture. I have founded a way to extract float value from my EXR depth texture on C# side. Now I need to pack into png image.
Original code is:
const vec4 bitSh = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0,256.0, 1.0);
const vec4 bitMsk = vec4(0,1.0 / 256.0, 1.0 / 256.0,1.0 / 256.0);
vec4 comp = fract(depth * bitSh);
comp -= comp.xxyz * bitMsk;
I can easily emulate vec4 with C#.
But what about this fract(depth * bitSh) part?
What is actually going on in there?
And what comp.xxyz stands here for?