Hi. In the unity documentation here http://docs.unity3d.com/Documentation/Components/SL-Blend.html it says you are able to set different blend factors for alpha and color channels. When I try giving the shader more factors nothing changes. The first two factors are used but the second two are ignored completely. Blend SrcAlpha OneMinusSrcAlpha, DstAlpha OneMinusDstAlpha is no different from Blend SrcAlpha OneMinusSrcAlpha. I can't find any examples of this being used and have no idea what I could be doing wrong. Has anyone come across similar problems?
I'm seeing the same rendering results with Blend SrcAlpha OneMinusSrcAlpha, SrcAlpha OneMinusSrcAlpha and Blend SrcAlpha OneMinusSrcAlpha, Zero Zero. I think it's broken.
Blend SrcAlpha OneMinusSrcAlpha, SrcAlpha OneMinusSrcAlpha
Blend SrcAlpha OneMinusSrcAlpha, Zero Zero
Answer by Owen Reynolds
Aug 19, 2013 at 01:39 PM
The specific values you're using won't ever show a difference. You'd have to be using DestAlpha for the colors, and have three+ overlapping textures. The third one would have the change. A rundown:
Commonly you ignore the alpha of the screen pixel, which means there's no point caring about alpha blend factor. Using SrcAlpha OneMinusSrcAlpha means that a fog pixel with an alpha of 20% will blend 20/80 with the background pixel. That's normally what you want. Even if the background was a complex combo of glass and fog, yellow 20% fog over it will tint it 20% towards yellow.
Now, the new alpha probably be 100%*80% + 20%*20% = 84%. That's a stupid value, but who cares, since no one will ever look at it. The next fog plane will use it's own alpha/1-alpha.
Say you were using DestAlpha OneMinusDestAlpha for the blend. Then the base pixel's alpha would control the final color. It's hard to think of a time you'd want that. Since, look at any transparent texture and think about swapping in a different alpha channel. Ick.
But, if you did, then after blending two textures, you'd have a new Alpha in that pixel, which the next DestAlpha OneMinusDestAlpha would look at. So you might use DA OmDa Sa OmSa, to make a chain letter: "I ignore my alpha when I blend with something (I use yours,) but the next guy has to use mine."
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
17 People are following this question.
Object with an extra material is blending the extra one with another!
What is the best way to create a simple colored plane object in NGUI?
How can i make the ball in a Pong game move without using rigidbody function and bouncy (Physics Material)
Lighting indoor and material
Acessing Shader Properties in a object that has two materials