I’ve been experimenting with blending operation for Unity3D shader for a while and currently stuck on the following problem.
When I tried using…
Offset -1, -1
Cull Off
ZWrite Off
Blend One OneMinusSrcAlpha
BlendOp Min
With a constant SrcColor
value of float4(1.0, 1.0, 1.0, SrcAlpha)
, I expected the result would be any DstColor
with the lowest SrcAlpha
specified on fragment shader, similar to…
Min(float3(1.0, 1.0, 1.0) * One, DstColor * OneMinusSrcAlpha)
In other word, I expected the result would be always from the second value of BlendOp
arguments, i.e. any previous color from the screen darkened with the factor of OneMinusSrcAlpha
.
However the actual result is always DstColor
without being affected by OneMinusSrcAlpha
factor.
Interesting stuff is when I tried…
Offset -1, -1
Cull Off
ZWrite Off
Blend Zero OneMinusSrcAlpha
With constant SrcColor
of float4(0.0, 0.0, 0.0, SrcAlpha)
and default BlendOp
config, the result color is actually darkened, that’s why I assume that it is actually being affected by the factor of OneMinusSrcAlpha
.
Am I missing something here?