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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Speed Tree Shader - How to Fade?

Discussion in 'Shaders' started by Jesse_Pixelsmith, Aug 6, 2015.

  1. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    295
    Hi - we're making a top down game, and one of the issues with that is you occasionally get stuff that blocks your character. Some games put a shader on characters to make them glow behind objects (TorchLight2) while others like Grim Dawn, (game I worked on) did fading of the occluding object when it got between you and the camera.

    I have a system like this working for objects using the standard shader (I switch the render mode to Fade and set the alpha on material instance).

    I want to do the same thing for the SpeedTree shader, but it obviously doesn't have a built in "Fade" mode, like the standard shader does. The shader-fu is pretty weak in me, I'm wondering if some friendly guru might be able to give me some pointers or if this has already even been done somewhere.

    Below you can see 2 pics of the tree, one is opaque and one is mostly transparent ( a bit *too* transparent for my tastes, but thats just an alpha value I'll play with :)

    Thanks!








     
  2. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    295
    polite bump
     
  3. Xoduz

    Xoduz

    Joined:
    Apr 6, 2013
    Posts:
    135
    Are these terrain trees? Or manually placed out? *curious*
     
  4. Jesse_Pixelsmith

    Jesse_Pixelsmith

    Joined:
    Nov 22, 2009
    Posts:
    295
    My games trees are manually placed (well non terrain based). The screenshots are examples from Grim Dawn which uses a different engine.
     
  5. jococo

    jococo

    Joined:
    Dec 15, 2012
    Posts:
    232
    I'm dealing with this right now. Did you find a solution?
     
  6. Phesant33

    Phesant33

    Joined:
    Nov 13, 2015
    Posts:
    34
    Has anyone found a good solution?
     
  7. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,463
    Hi, did you get an answer for this? I think you might need to use raycast then set the alpha value, but it depends if the shader supports transparency... hope you won't mind sharing if you have a solution.
     
  8. Xoduz

    Xoduz

    Joined:
    Apr 6, 2013
    Posts:
    135
    I mentioned in a similar thread my own solution for this, if you want to check it out.
     
  9. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,463
    Cool! many thanks!