I am doing some animation jobs. I need to pack some pivots into UV and then my shader can read them.
I need to pack 4 float3 into a float4. Therefore, I need to pack each float3 into a float.
These 4 float3 are (model space position1, direction1, model space position2, direction2). I know how to handle the directions because they are normalized. I can use something like:
#define f3_f(c) (dot(round((c) * 255), float3(65536, 256, 1)))
#define f_f3(f) (frac((f) / float3(16777216, 65536, 256)))
But How can I pack these positions? I am using SM3.0 and I can't use bitwise operations