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

How Do You Fade To Transparent A Skinned Mesh?

Discussion in 'Getting Started' started by Bill_Martini, Sep 15, 2020.

  1. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    I've been searching for days for an answer to this. Googling, there are dozens of posts claiming that adjusting the materials color alpha will do this, but I'm unable to get this to work. I've tried two different (free) dissolve shaders and neither works and with no response from the author. I'm using v.2019.3, are there any known issues?

    Can someone provide me with a solution? Thank you...
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,842
    I'm sorry I don't have a solution at hand to hand you, but I have done this in the past and can describe what works. Basically, you need a transparent shader, and one that pays attention to the alpha of the main color rather than just the texture.

    Such a shader isn't too hard to write, if you want to delve into that. I'd also be a bit surprised if the standard shader can't do this if you set it to transparent mode.
     
    Bill_Martini likes this.
  3. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    Yeah, me too! I've tried transparency and fade on every shader built-in and nothing worked. There are dozens of examples on the internet stating changing the alpha will do this but don't specifically state which shader they are using.

    I can't believe I'm struggling with this, it should be an out-of-the-box feature for any game engine. Still looking...

    Thanks Joe.
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,510
    Are you sure your changes are being applied to the object instance? Have you tried setting up the transparent material ahead of time and swapping it out, or changing other material properties?

    I remember before running into the issue of trying to change material properties directly not doing anything (or giving errors). I had to store the material into a variable, change the properties, and then reassign the material to the object instance's renderer to get it to actually work.

    Sorry I don't have anything more specific than that.
     
    Bill_Martini and JoeStrout like this.
  5. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    Well that's pretty much how it's supposed to be done according to a bunch of postings.

    I get the renderer components material and save the color to a new Color var, adjust the alpha of the new color and save it back to the material. But this doesn't even work in the inspector either. I've created a new cube and a new material. Applied the material to the cube. Set the color of the material to red and the cube turns red. Adjust the alpha and nothing happens.

    Thanks @Schneider21 for the assist.
     
  6. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,510
    Bill_Martini likes this.
  7. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    Yes, I tried both transparent and fade on the shader option. I'm going to try a different version of Unity and see if I can reproduce the problem.

    Many thanks.