I am recreating Photoshop blending and I am trying to use the Linear Light mode. In Photoshop, you will have a background layer with 100% opacity, and then a top layer with an opacity of 50%, which is set as linear light as the blend mode.
I found information on how to make the Linear Light blend, but it only works when both layers have 100% opacity.
Here is the shader code that will work in Linear Light mode and gives the same result as Photoshop when the layers have 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 looked at http://en.wikipedia.org/wiki/Alpha_compositing , but I still have problems.
How can I make blend mode work for translucent layers?
source share