Unity Shader:Blend 混合
Blending is used to make transparent objects.
When graphics are rendered, after all Shaders have executed and all Textures have been applied, the pixels are written to the screen. How they are combined with what is already there is controlled by the Blend command.
混合不仅仅用于透明度混合,我们要开启混合,在Unity中设置的同时也进行了开启,但如果在其他图形API中是需要我们自己手动开启的。
源颜色(Src,source color):由片元着色器产生的颜色值
目标颜色(Dst,Destination color):从颜色缓冲中读取到的颜色值
这里的颜色值都是包括RGBA四个通道
1 混合命令语法(Syntax)
Blend Off
Turn off blending (this is the default)
默认设置,关闭混合
示例:
Blend Off
Blend SrcFactor DstFactor
Configure and enable blending. The generated color is multiplied by the SrcFactor. The color already on screen is multiplied by DstFactor and the two are added together.
开启混合并设置混合因子。源颜色会乘以SrcFactor,而目标颜色会乘以DstFactor,然后把两者相加再存入颜色缓冲中
示例:
Blend SrcAlpha OneMinusSrcAlpha
透明度混合的命令