Search Unity

Alpha map texture

Discussion in 'Shaders' started by inno, Feb 19, 2009.

  1. inno

    inno

    Joined:
    Oct 9, 2008
    Posts:
    39
    Hi Guys,

    I am not sure if someone else has already asked about this, but is there a shader in Unity that supports apha maps? If not does anyone knows how to write a custom shader that supports it?

    Thanks
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    What is an "alpha map"? Is it just regular transparency, like in Transparent shaders?
     
  3. inno

    inno

    Joined:
    Oct 9, 2008
    Posts:
    39
    I mean an opacity map just like in 3ds max. A black and white image. Everything in white will be visible and everything in black will be transparent.
     
  4. duck

    duck

    Unity Technologies

    Joined:
    Oct 21, 2008
    Posts:
    358
    You need to use an image editor to put that black white image into an alpha channel of your colour image.

    Then once it's in unity, use it with one of the Transparent shaders, such as Transparent/Diffuse.

    (notice in the inspector, for the transparent diffuse shader, it says "Base(RGB) Trans (A)". This is telling you that the A (alpha) channel will be used for the transparency.
     
  5. inno

    inno

    Joined:
    Oct 9, 2008
    Posts:
    39
    Ok i undestand. I tried it and it works fine.

    Thanks a lot
     
  6. MarkGX

    MarkGX

    Joined:
    Dec 18, 2010
    Posts:
    30
    Here are the DAZ Studio to Unity Texture/Shader Mappings that work for me.
    I'm still very new to this stuff so please if anyone knows better please update this thread.


    DAZ / Unity Texture Mapping
    Filename_M (Texture Map) Import Texture
    Filename_B (Bump Map) Import Normal Map (Do not generate grey scale)
    Filename_Tr (Transparency Map) Import Normal Map ( Do not generate grey scale )

    DAZ / Unity Shader Mapping
    (B, M) Bumped Diffuse
    (Tr) Transparent/Diffuse
    (B,Tr) Transparent/Bumped Diffuse

    Digimi Texture Atlas
    diffuse_Image_1_AtlasUVs Unity Texture Map Type Diffuse
    opacity_Image_1_AtlasUVs Unity Transparency Map Type (Tr)

    In the situation where a material is using (B, M, Tr) I'm using Transparent/Bumped Diffuse Shader but is there a better shader option?
     
    hotkeysss likes this.
  7. eugenem79

    eugenem79

    Joined:
    Oct 6, 2011
    Posts:
    1
    Hi! Would you please explain how to insert alpha layer into texture? No graphic designer that I know know how to do that :(
     
  8. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
  9. SympaK

    SympaK

    Joined:
    Apr 14, 2010
    Posts:
    134
    Not very clear. I'm looking for infos too.
     
  10. Deleted User

    Deleted User

    Guest

    in photoshop you go to the channels palette and hit the "create new layer button", photoshop automatically creates an alpha channel; then you just paste or paint whatever alpha you want to use (white: opaque; black: transparent)

    but I am having problems with it too: the transparency sorting doesn´t work in my case; and the tutorial posted by eugenem79 seems a bit strange to me as it doesn´t mention how to deal with semi-transparent areas in your texture; gonna do some research. as soon as I get it I will give you an update.

    EDIT:
    I had this sorting problem while using one shader for a window (frame and glass); as soon as i applied a second shader to the glass, the transparency sorting worked.
     
    Last edited by a moderator: Feb 26, 2013
  11. SupaFinga

    SupaFinga

    Joined:
    Apr 19, 2013
    Posts:
    2
    It's simple, really. You make your texture in a format that supports transparency (PNG for example) and make the transparent parts of your model transparent on your color map. Basically your color map is also your alpha map. You just have to use a shader that supports transparency and import your texture with the alpha.
     
  12. Giantbean

    Giantbean

    Joined:
    Dec 13, 2012
    Posts:
    144
    For anyone else finding this, if I am understanding the initial question properly, you can just use a standard shader and in the material set the alpha source to "From Gray Scale" and put a check mark in Alpha is Transparent. Then set the material rendering mode to Transparent cut out or fade. Of course you can also use transiency as mentioned above but if you want a black and white alpha map that's how you can do it.
     
    ksam2 likes this.
  13. unity_03shiju123

    unity_03shiju123

    Joined:
    Apr 3, 2020
    Posts:
    3
    you can use psd file as a texture with a alpha channel, then create a material with shader from legacy shader, then transparent->cutout->diffuse.In this shader you can see input texture has both Base(RGB) Trans(A),so it shows that it can accepts Alpha channel also upload_2022-12-1_23-43-51.png this texture has four channels RGBA upload_2022-12-1_23-40-47.png
     

    Attached Files: