HLSL: Pack 4 values into 32 bit float.

Posted by TheBigO on Game Development See other posts from Game Development or by TheBigO
Published on 2011-01-29T19:33:25Z Indexed on 2011/01/29 23:33 UTC
Read the original article Hit count: 272

Filed under:

I can't find any useful information on packing 4 values into a 32 bit float in HLSL.

Ideally, what I want to be able to do in HLSL is:

float4 values = ... // Some values where each component is between 0 and 1.
float packedValues = pack32R(values);
float4 values2 = unpack32R(packedValues);

I realize that there will be precision limitations, and performance tradeoffs between different precisions in different methods. I'm just wondering what ideas are out there.

© Game Development or respective owner

Related posts about hlsl