3
\$\begingroup\$

I am wondering about the performance behind color-space conversions for textures during reading.

If a project decides to go with a linear workflow, as in, when doing any sort of color manipulation, like lighting, they operate on within the linear color-space, is there any good reason to not store all texture assets in the linear color-space?

My understanding is that when loading textures which are stored in sRGB, the GPU can do the conversion to linear for you very quickly. Is that cost completely negligible? Why not just store all the textures in that form?

The only reason I can think against this is that you may want to store the textures in a color-space that looks like the one you intend to display to (if you're going to display to sRGB then you should store the textures in sRGB). In that case, why not master the texture as sRGB but then store them on disk already converted to linear colorspace?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ If you think this might be a good solution for your game, have you tried it? That will let you measure whether the performance is better for your particular use case, and whether the output quality is equivalent for your needs. You'll be able to trust the results of your own measurement on your own game much more than hearsay from Internet strangers like us. ;) \$\endgroup\$
    – DMGregory
    Commented Jul 3, 2020 at 12:20

1 Answer 1

1
\$\begingroup\$

You would need a higher bit-depth to achieve the same quality if you store the textures in linear. See https://en.wikipedia.org/wiki/Gamma_correction#Explanation.

Is the cost of the conversion completely negligible? I don't know but I've read that it is very cheap on current GPUs. You could try profiling to find out.

\$\endgroup\$
2
  • \$\begingroup\$ This answer would be better if it included an example of the kind of quality loss to expect when using linear storage, and an example of the profiling result for the conversion. For completeness, you should probably also profile the added cost of the higher bit-depth storage you're recommending. \$\endgroup\$
    – DMGregory
    Commented Jul 3, 2020 at 12:18
  • \$\begingroup\$ @DMGregory Just to be clear, I would recommend storing the textures in sRGB, not linear, but If you do choose to store them in linear you will notice more banding on dark color gradients for the same bit-depth. \$\endgroup\$ Commented Jul 3, 2020 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .