Search Unity

Mesh tree support problem on terrain

Discussion in 'World Building' started by ttw1993, Apr 15, 2021.

  1. ttw1993

    ttw1993

    Joined:
    Jul 19, 2017
    Posts:
    11
    Hello guys:

    I try to build terrain in Unity and draw trees.
    At first I used the Unity tree Creator tree. Adjust the tree density of the brush and the color change slider of the tree, and it work fine. I can generate trees with random colors and different densities.
    But when I switch to using the Mesh tree, the above two adjustments will not take effect. The tree density brush is always very dense, and the color randomness does not work. For the color problem, I tried to add the _treeInstanceColor color reading code to my Mesh tree shader, but it didn't work.
    Any suggestions and guidance are greatly appreciated.
    upload_2021-4-15_16-29-25.png
    upload_2021-4-15_16-44-39.png

    I use the following shader code to try to receive the color from the tree instance and multiply it with the final color, but it does not work。Part of the code is omitted

    Code (CSharp):
    1. [HideInInspector] _TreeInstanceColor ("TreeInstanceColor", Vector) = (1,1,1,1)
    2. fixed4 _TreeInstanceColor;
    3. o.Albedo = temp_output_35_0.rgb * _TreeInstanceColor.rgb;
     
    Last edited: Apr 15, 2021