Search Unity

Resolved How to turn black color to transparent in Shader Graph 10.5?

Discussion in 'Universal Render Pipeline' started by HexDog, Sep 22, 2021.

  1. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    57
    Hi want to creat a smoke orb shader but the issue is i can not turn the black color to transparant in my shader, is any body can help with this? kép_2021-09-22_112752.png
     
  2. Jonas-Mortensen

    Jonas-Mortensen

    Unity Technologies

    Joined:
    Jan 3, 2020
    Posts:
    110
    Hi!
    The Base Color property on the fragment node takes a vector3. You can see the vector4 (pink) output from the sample node being transformed into a vector3 (yellow) effectively discarding the transparency (alpha). What you need is to pipe the A output of the sample node into the alpha property of the fragment node. Hope the works for you!
     
  3. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    57
    Hi, The problem is my texture is contain black color so not the alpha parameter is the case, i want to replace the black color with transparent. If i some how can turn this shader's blend mode to additive it could be solve the problem, but the new Shader Graph doesn't contain this feature.
     
  4. Jonas-Mortensen

    Jonas-Mortensen

    Unity Technologies

    Joined:
    Jan 3, 2020
    Posts:
    110
    In that case you should be able to take the red channel from the sample node and put that into the Alpha property of the fragment node.
    That will still alpha blend the material though.

    Additive blending should also be available to you. Do you not see it in the Blending Mode drop down in the Graph Settings tab of the Graph Inspector?
     
  5. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    57
    Oh! Finaly i find it, thanks for the help!:)
     
  6. DaDarkDan

    DaDarkDan

    Joined:
    Jan 16, 2017
    Posts:
    7
    This does not seem to work for me. My texture also only has RGB and no A. Changing the blending mode has no real difference either.
    upload_2023-5-29_13-38-22.png
     

    Attached Files:

  7. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    769
    Looks like the darkest parts of the texture are too "bright" for alpha channel (pure black represents 0 alpha).

    You can try increasing the texture's saturation (at least for alpha channel) and see if it helps.
     
  8. BackTrak

    BackTrak

    Joined:
    Mar 4, 2024
    Posts:
    1
    This worked for me, without dimming the texture at all. 0.01 fuzzyness seems to do the trick pretty well.

    black to transparent.png
     
    HexDog likes this.
  9. HexDog

    HexDog

    Joined:
    Mar 31, 2019
    Posts:
    57
    Hi, it's been 3 years now since I posted this thread, and I've learned a lot along the way, but I appreciate your time, thanks! :)