PVRTexLib sRGB and Gamma

First off: PVRTexLib is both quite powerful and easy to use. Thanks a bunch for making it available!





However, the documentation does not address how color space conversions are handled. I am very carefully trying to avoid non-linear image processing in our art pipeline and I was wondering how to achieve that using PVRTexLib.





Specifically, what I would like to do is: Load an sRGB image. Convert to linear space. Premultiply RGB by Alpha. Generate mipmaps. Convert back to sRGB. Compress to PVRTC.





Here’s how I’m currently calling into the library: Create a texture with DX10_R8G8B9A9_UNORM_SRGB. Decompress to eFloatStandardPixelType. ProcessRawPVR with the mipmap count set and bPremultAlpha=true. CompressPVR from float to OGL_PVRTC4.





I’m hoping that the Decompress does gamma->linear, that Process assumes linear and that Compress does linear->gamma. Can I get some confirmation that this is what is actually happening under the hood?





Thanks!

Answering up on my own question: I finally noticed that the doc does indeed address how color spaces are handled.





"Although some of the formats below are for use in specific colour spaces PVRTexLib is not colour


space aware and it is up to the user to ensure that data from the correct colour space is used with


PVRTexLib."





I’ll take this to mean that there are no sRGB->Linear->sRGB operations happening anywhere in the pipeline? No big deal. I’ll just insert my own conversions between the byte->float and float->compressed stages.

Hi corysama,

This is correct, colour space conversion does not occur within PVRTexLib so you will need convert it yourself to linear and back again. PVRTexLib essentially will always assume that data passed to it is in a linear format.

Thanks,

Tobias