Photoshop Blends in sRGB Space, Not in Linear

Pope Kim Nov 3, 2009

First for those people who are not familiar with Gamma, sRGB and Linear Spaces, here is a good presentation explaining all of these: Picture Perfect: Gamma through the Rendering Pipeline

Recently I had to do some texture compositing in-game using shaders. The artists' workflow involves stacking up all those textures to be composited in Photoshop using Photoshop blending mode to preview, and then our engine composites them in real-time using the same blending mode.

However, with the recent addition of gamma-correction to our engine, everything started to look weird, so I had to investigate it. To my surprise, Photoshop is doing all the blendings in sRGB space instead of mathematically correct linear space. Since artists' workflow overweights mathematical correctness, I had to make sure our shaders work the same as Photoshop. And I thought there must be someone who would go through the same try-and-mistake fun time, so I'm making a note here.

Photoshop does blendings in sRGB space. No, not in linear space