我正在重新制作一些Photoshop混合效果,并尝试使用线性光模式。在Photoshop中,您需要一个100%不透明度的背景图层,然后是一个50%不透明度的顶部图层,将其设置为线性光混合模式。
我找到了如何进行线性光混合的信息,但仅当两个图层都为100%不透明度时才有效。
以下是可以执行线性光模式并在两个图层都为100%不透明度时与Photoshop给出相同结果的着色器代码:
我看了一下Alpha Compositing,但还是有些问题。
我找到了如何进行线性光混合的信息,但仅当两个图层都为100%不透明度时才有效。
以下是可以执行线性光模式并在两个图层都为100%不透明度时与Photoshop给出相同结果的着色器代码:
#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))))
我看了一下Alpha Compositing,但还是有些问题。
如何使混合模式适用于半透明图层?