- Home /
Shader's BlendOp Min Question
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?
Answer by Jessy · Jul 04, 2013 at 11:51 PM
Asked/answered on the forum nine months ago: http://forum.unity3d.com/threads/154516-BlendOp-functionality-and-usage-questions?p=1059096&viewfull=1#post1059096
Min and Max don't take the multiplicative factors into the equation; the Blend line of code is useless and ShaderLab ought to tell you about it in the Console, but doesn't at this time. Note that the other three BlendOps work as you expect.
Very interesting indeed, it does make sense when you put it that way. I will assume "$$anonymous$$in and $$anonymous$$ax don't take the multiplicative factors into the equation" as an answer. Thanks.
Your answer
![](https://koobas.hobune.stream/wayback/20220613105504im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Skybox blending 2 Answers
Blend colors in overlapping areas. 1 Answer
Making specific shader for texture transition effect 1 Answer
Decal Alpha Blend 0 Answers
¿UsePass overrides Render State? 0 Answers