Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Custom tree billboard shader/material

Discussion in 'Shaders' started by Mingo, Jun 5, 2011.

  1. Mingo

    Mingo

    Joined:
    Nov 14, 2010
    Posts:
    39
    Hello.

    I've just been experimenting with the good old "day/night" cycle and all the hilarious lighting issues that come with it, and would like to replace the built-in Unity shader for billboarded trees as it does not seem to react to any kind of lighting (even ambient) and they look terrible if you have changing light levels in your outdoor scene.

    I can drop in a replacement shader just fine based on the source of the built-in billboard shader and adjust the colour value in this new shader manually (in the shader source itself), but I can't figure out a way to pass a parameter into this at runtime so that I can adjust the colour value depending on the time of day or ambient light or whatever.

    If I had access to (or could override) the actual material used on these billboard trees I assume I could just pass this variable in with a script and adjust it whenever I wanted to during runtime, but I'm unsure how (or if) I can do this. Is what I'm trying to achieve here possible, before I waste any more time on it?
     
  2. duke

    duke

    Joined:
    Jan 10, 2007
    Posts:
    763
    Check out how this is done with Chris' bump mapped terrain shader. It involves attaching a script to your terrain.
     
  3. Martin-Kraus

    Martin-Kraus

    Joined:
    Feb 18, 2011
    Posts:
    617
    Last edited: Aug 27, 2011
unityunity