Shader 的 Blend
Blend SrcAlpha OneMinusSrcAlpha //alpha blending Blend One OneMinusSrcAlpha //premultiplied alpha blending Blend One One //additive Blend SrcAlpha One //additive blending Blend OneMinusDstColor One //soft additive Blend DstColor Zero //multiplicative Blend DstColor SrcColor //2x multiplicative Blend Zero SrcAlpha //multiplicative blending for attenuation by the fragment's alpha
如上,Blend有许多种,如果不熟悉他们的效果,只需记住下面的公式:
float4 result = SrcFactor * fragment_output(计算出来的颜色) + DstFactor * pixel_color(已经存在的颜色);
(在混合操作中,我们将片段着色器中计算出来的颜色称之为 “源颜色”,帧缓存中对应的像素已经存在的颜色叫做“目标颜色”。)
而混合操作的基本语法为
Blend SrcFactor DstFactor
然后推算和尝试,去获得想要的结果,多了就能一眼看出各个Blend的效果了。
原文地址:http://www.cnblogs.com/daxiaxiaohao/p/4059310.html