In the course of preparing my (D3D11) renderer to move towards HDR-capable rendering, I've taken the long-overdue step of moving from sRGB-ignorant rendering to sRGB-compliant. I thought it may be illuminating to share my experience, and see if anyone had thoughts and/or similar issues.
One handy migration feature I worked to provide myself was the ability to run the game in either sRGB mode or sRGB-ignorant mode (via a command-line switch). This was ultra-handy for doing A/B comparisons. Mainly for the purposes of tracking down issues and experimenting, I implemented sRGB<->Linear conversion routines for both C++ and HLSL, along with handy utility accessors to determine what mode we're running in and doing "the right thing"/conversion automatically. It's expected that sRGB->Linear conversion will generally be the default when loading attribute color data in sRGB mode.
Of course, setting the appropriate display render target formats was the starting point, to allow for automatic sRGB output conversion. In my case, for the first phase, this is simply moving from R8G8B8A8_UNORM to R8G8B8A8_UNORM_SRGB (eventually, this will shift to a float format later down the line). In addition to the normal monitor output target, it was important to make sure I specified/changed the necessary VR render targets accordingly as well.
Next, I converted all textures from old DXT* formats to BC* formats, and specifically color textures to BC SRGB formats, which will automatically set up sampling to do automatic SRGB->Linear conversion.
I collaborated with ChuckW to update DirectXTK texture loading to allow for ignoring/discarding _SRGB BC format modifier, which allowed for easy switching between sRGB and sRGB-ignorant modes using the same textures.
Generally speaking, I treated all attribute/material color values as sRGB (meaning they are converted to linear on load for calculations, etc.). The overall thought being these values would be selected via a color wheel or similar mechanism by content creators (read; a color on a monitor, thus sRGB). Existing data was either generated via model export (in which case this is likely the proper way to interpret the existing data), or values manually entered by me via a text editor, which meant they are now off. The basic methodology was to take this hit on existing manual data. Via my attribute system I added a way to selectively take a value based on if it has an SRGB tag specified (true/false), which allowed me to hand-tweak values (have both an sRGB one and a non-sRGB one) and be able to run in either sRGB or sRGB-ignorant modes to compare. This allowed me to be able to hand-adjust problematic values in specific instances.
One of the most noticeable effects of being sRGB-aware is that alpha-blending results are different. Light text blending onto dark backgrounds looks better (appropriately "thick"), while dark text on light backgrounds looks worse ("thinner", as it were). When you consider that alpha-blended values in the mid-range will be brighter, this result makes sense. Similarly, additive alpha-blended effects are generally "brighter"...post-process glow is much more noticeable (a desirable result). Things like SSAO, however, are generally more subdued. Again, this makes sense when you consider the curve. SSAO is interesting, as this means the effect is lessened ("shrinks").
Another expected result of sRGB-aware processing is that several techniques that produced linear gradients now exhibited banding artifacts. In particular, in my crepuscular rays processing I had to shift from using an R8G8B8_UNORM output render target to R11G11B10_FLOAT. Further, I also had to add a dither effect to completely eliminate banding (most egregious in VR, which generally is more sensitive to banding issues).
Overall, the process wasn't too difficult. However, I remain a little non-plussed that I could not replicate my sRGB-ignorant output more closely in all cases. SSAO, and my crepescular rays color in particular (which I had "mathematically" specified manually) are still not as close as I want. SSAO I think will just take some adjusting to it being a little more subtle. The color values are a little more vexing. Simply trying to convert them to/from sRGB values doesn't really do the trick (nor do I really expect it to), and given that the results can be technique-dependent, I think I'll probably have to adjust to the fact that this shift and data expectation means using programmer brain to make a nice blue hue via typing in (0.33, 0.33, 1.0) is no longer the paradigm I'm operating under. And, of course, this is a bit of the "worst-case" scenario of having a lot of existing data where you're trying to match a particular look (on your own), versus being able to simply have the artists go back and properly revisit assets themselves.
While this topic has been explored in several previous threads, I'd be interested to hear your own experiences (recent or otherwise) with doing similar sRGB-aware conversions. In particular, your thoughts on attribute color data specification (materials, shader parameters), and if you had similar issues with things like SSAO, blending, etc., and how you handled it would be enlightening.