Search Unity

  1. Dismiss Notice
  2. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice

Custom tree billboard shader/material

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

  1. Mingo


    Nov 14, 2010

    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


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


    Feb 18, 2011
    Last edited: Aug 27, 2011