Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Are all Blend combinations equal in performance costs?

Discussion in 'Shaders' started by shaderbytes, Apr 15, 2013.

  1. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    900
    For example does using

    Blend Zero SrcColor

    instead of

    Blend SrcAlpha OneMinusSrcAlpha

    have a difference in performance , or are all combinations of Blending equal?
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    How much depends on the hardware, but different factors definitely change the per-fragment cost of blending.
     
  3. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
  4. shaderbytes

    shaderbytes

    Joined:
    Nov 11, 2010
    Posts:
    900
    Ok thanks

    Im going to use Blend Zero SrcColor then . Its for a DMD mask and with android not having compressed alpha texture support I can use a etc4 black and white texture with this Blend combination to achieve the same visual result as if it were an alpha overlay.
     
  5. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    It's important to keep in mind that the 3GS represents a very specific type of device: a tiled deferred renderer with relatively few pixels to fill. I would be surprised if there weren't more traditional hardware that saw a speed boost from not having to read from the frame buffer.
     
  6. Martin-Kraus

    Martin-Kraus

    Joined:
    Feb 18, 2011
    Posts:
    617
    I wouldn't be surprised because once blending is enabled in traditional fixed-function hardware, the data might be (computed and) transferred in any case, even if it is multiplied with 0 in the blend equation.
     
  7. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    I blended a ton of meshes until the framerate plummetted. Many pixels more than what the screen represents had to be blended. No rendering could be deferred because nothing was opaque.

    No difference in modes.