Unity3D shader Blending

混合(Blending)是计算机呈现渲染结果的最后阶段,每一个像素将被绘制到屏幕上。

混合的基本公式:Blend SrcFactor DstFactor  将前面各种计算产生的颜色(fragment_output )*SrcFactor+当前屏幕的颜色(pixel_color)*DstFactor  等价于float4  result = SrcFactor * fragment_output + DstFactor * pixel_color;

混合的一个基本参数介绍:

CodeResulting Factor (SrcFactor or DstFactor)
Onefloat4(1.0)
Zerofloat4(0.0)
SrcColorfragment_output
SrcAlphafloat4(fragment_output.a)
DstColorpixel_color
DstAlphafloat4(pixel_color.a)
OneMinusSrcColorfloat4(1.0) - fragment_output
OneMinusSrcAlphafloat4(1.0 - fragment_output.a)
OneMinusDstColorfloat4(1.0) - pixel_color
OneMinusDstAlpha

float4(1.0 - pixel_color.a)

 

所以 对于任何混合命令 套用以上公式 即可。

例如:Blend SrcAlpha OneMinusSrcAlpha  等价于 float4  result = float4(fragment_output.a) * fragment_output + float4(1.0 - fragment_output.a) * pixel_color;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值