I'm recreating some Photoshop blending and I'm trying to use Linear Light mode. In Photoshop you'd have a background layer at 100% opacity and then a 50% opacity top layer that is set to Linear Light as the blend mode.
I did find info on how to do the Linear Light blend, but it only works when both layers are at 100% opacity.
Here is the shader code that will do Linear Light mode and it gives the same result as Photoshop when layers are both at 100% opacity:
#define BlendLinearDodgef BlendAddf
#define BlendLinearBurnf BlendSubstractf
#define BlendAddf(base, blend) min(base + blend, 1.0)
#define BlendSubstractf(base, blend) max(base + blend - 1.0, 0.0)
#define BlendLinearLightf(base, blend) (blend < 0.5 ? BlendLinearBurnf(base, (2.0 * blend)) : BlendLinearDodgef(base, (2.0 * (blend - 0.5))))
I've looked at http://en.wikipedia.org/wiki/Alpha_compositing but am still having issues.
How can I get the blend mode to work for semi-transparent layers?