Search Unity

water over billboard trees problem

Discussion in 'Editor & General Support' started by Zaffer, Mar 27, 2012.

  1. Zaffer

    Zaffer

    Joined:
    Oct 21, 2010
    Posts:
    266
    $water_over_tree.JPG

    Hi,
    I used the Transparent/Bumped Specular shader to make my own water shader for a river and lake. As you can see from the attached picture, the river/water shows through the tree in front of it -- but only when the tree is billboarded. I found a thread with a similar question and answer here http://forum.unity3d.com/threads/77544-3.2-Water-over-billboard-trees, but the fix given by Code Monkey involved editing the FX-Water3.shader like this:
    I would like to see if I can edit the Transparent/Bumped Specular shader in a similar way if possible, but it does not seem to have an Edit button like most of the other shaders. Any suggestions? Thanks.

    Zaffer
     
  2. a1s2d3f4

    a1s2d3f4

    Joined:
    Mar 20, 2011
    Posts:
    415
    ive been having the same problem :/
     
  3. Zaffer

    Zaffer

    Joined:
    Oct 21, 2010
    Posts:
    266
  4. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    I have the same problem and used the solution to customize my transparent shader as described above ("Queue"="Transparent-200").
    Right, it works!

    But there are two points why I think it´s not a satisfying solution:

    1. When using multiple transparent shaders, we have to edit them all by hand.
    2. What about the special case of a transparent glass-architecture-facade where trees are placed in front of it and also behind it?
    Trees that stand behind the facade now appear in front it (of course!).
    Read more about this problem here.

    For Point 1 I would say it´s best to change the trees billboard shader instead!
    We can download it here.
    It´s placed in builtin_shaders\DefaultResources\TerrainShaders\Trees\BillboardTree.shader

    Here I write "Queue"="Transparent-50" in line 7 and 379. This should work - right?
    But it doesn´t :-(
    I´m not sure if Unity already uses my custom billboardshader:
    How to tell Unity to use my custom BillboardTree.shader instead of the original?

    For Point 2 I don´t see any smart solution, do you?
    I´m very happy with Unitys internal DepthSorting of transparent objects in general, but it should also work with billboarded trees!
     
    Last edited: Apr 26, 2012
  5. shawn

    shawn

    Unity Technologies

    Joined:
    Aug 4, 2007
    Posts:
    552
    You need to reload the project in order for assets that override the built-in default resources to take effect.

    There is no magic solution. Engines can't 100% accurately guess (while maintaining good performance) what order overlapping transparent objects should render. The best way to combat this problem is to avoid situations where alpha-blended objects overlap. One of the easiest solutions is trying to use an AlphaMask shader instead of an AlphaBlended shader.
     
  6. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    I see, but: When I use a standard-unity transparency-shader there´s no problem at all.
    As soon as I use my own shader (written in Strumpy) I get this problem.

    So, there must be something in Unitys shaders that solves it, right?