Search Unity

AlphaToMask?

Discussion in 'Shaders' started by Jonathan Czeck, Dec 21, 2007.

  1. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    What does this ShaderLab line do:

    AlphaToMask True

    It's not documented. (Submitting a case on that.)

    Thank you!
    -Jon
     
  2. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
  3. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Yeah, it's there, but it's not documented because it's not of much use yet.

    What it does is Alpha to Coverage, like you guessed. That means, when using FSAA, alpha-tested objects can smoother outlines.
     
  4. JBC

    JBC

    Joined:
    Sep 4, 2010
    Posts:
    12
    Last I saw about this was an unresolved ticket filed with Apple. Any further news or does this still not work with Apple?
     
  5. aldis

    aldis

    Joined:
    Jan 8, 2011
    Posts:
    1
    -Projectors work well enough but they render each object they project on again, which is a performance monstrosity if I want to make bullet holes, for example.

    -I found a thread where somebody actually placed pixels on the texture of the objecty they wanted decals on, but you cannot reuse the texture. An alternate method is to use a secondary UV set like a lightmap, but lightmaps are too low-res to get any real detail. Not to mention, this method seems impractical.

    -By far the best method is making a plane and using the cutout shader, and displacing the plane slightly. However, this doesn't work if you want to put a decal on an object that isn't round.


    I have seen some examples of decals in Unity that I do not think use any of these methods, but I cannot figure out how they did it. Perhaps someone can help me out here? Decals are pretty important for my game and the help/advise would be appreciated.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    There is option 4: the now open source decal framework (search the showcase board) as base for whatever you need / want
     
  7. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    Which incidentally isn't free anymore. Mind posting the relevant snippets?
     
  8. Lex-DRL

    Lex-DRL

    Joined:
    Oct 10, 2011
    Posts:
    140
    It's ten years now since this thread was opened but still no documentation about this command. Neither which settings it requires nor how exactly to use it.

    Just now i had a weird issue: alpha-to-coverage shader worked just fine in one project, but didn't work in another. Both projects are exactly the same, with same project structure and all the project settings same, too (the ones displayed in the inspector).
    The only difference is that one project is converted from U4.6 while the other created from scratch in U5.
    I had to manualy compare project settings files in text mode and make their actual lines identical one-by-one until I finally found what exactly caused that.
    It took several hours.

    UT, could you please document this command?
    It's really difficult to use something if it doesn't work in a particular case and you don't even know why.
     
    daniel-hall likes this.