Is possible to unpack texture data following a specific bit packing scheme?

I have read that texture data in HLSL can be read in as 4 floats of 32 bits each totaling 128 bits. The packing scheme I'm looking to use is 16 packing groups of 8 bits each. I am having trouble figuring out how to unpack this data without loss due to it being interpreted as floats.

  • \$\begingroup\$ This might be a bit challenging to pack into a single texture sample - particularly if you want to support a range of devices, as not every texture format is supported across the board. Are you able to repack (or re-interpret) the data as 4 textures of 4 8-bit components, or 4 taps from a single texture with double the dimensions? This would let you use widely-supported 8bpc formats that can round-trip between integer and float representation losslessly. \$\endgroup\$ – DMGregory Nov 6 '19 at 17:42
  • \$\begingroup\$ That sounds like it could be a good solution. I'm still mostly foggy on how I could implement this. \$\endgroup\$ – Cyxxus Nov 6 '19 at 22:48
  • \$\begingroup\$ Can you give us a bit more detail about how this packed data is generated / what it represents / how it's unpacked, so we can tailor answers to be relevant to that context? \$\endgroup\$ – DMGregory Nov 6 '19 at 22:52
  • \$\begingroup\$ The data is used to identify the texture points as part of a group. e.i. It's a body texture so one group could be freckles and another could be laugh lines. Each texture point can be part of many groups. I wanted to know how unpacking would work before I combined the data into one texture so that I could tailor the data towards the solution. Each group will be colored using swatches so I don't need color data in these textures. \$\endgroup\$ – Cyxxus Nov 6 '19 at 23:00
  • \$\begingroup\$ Oh wow! And how many of these groups occur in a single material? \$\endgroup\$ – DMGregory Nov 6 '19 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.