【Blending】
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.
[Syntax]
Additionally, you can set upper-rendertarget blending modes. When using multiple render target (MRT) rendering, the regular syntax above sets up the same blending modes for all render targets. The following syntax can set up different blending modes for individual render targets, where N
is the render target index (0..7). This feature works on most modern APIs/GPUs (DX11/12, GLCore, Metal, PS4):
Blend N SrcFactor DstFactor
Blend N SrcFactor DstFactor, SrcFactorA DstFactorA
BlendOp N Op
BlendOp N OpColor, OpAlpha
[Blend Operations]
[Blend factors]
[常用混合类型]
[Examples]
1、Here is a small example shader that adds a texture to whatever is on the screen already:
Shader "Simple Additive" { Properties { _MainTex ("Texture to blend", 2D) = "black" {} } SubShader { Tags { "Queue" = "Transparent" } Pass { Blend One One SetTexture [_MainTex] { combine texture } } } }