Search Unity

Custom Trees

Discussion in 'General Graphics' started by SaphiBlue, Dec 29, 2019.

  1. SaphiBlue

    SaphiBlue

    Joined:
    Apr 18, 2016
    Posts:
    43
    Hello,

    I wanted to give my prototype more life, by making the enviroment more dynamic.

    I have some custom Trees which I created myself. I was able to Animate the Leafs with shadergraph which added alot of life to the scene.

    But the base of the root/trunk of the tree is a staic Object. Is it possible to have a slow Animation there, like a tree is slowly bending back and forward in the wind? Is an animationcontroller in this case a good choise?

    Because I using the HDRP, i cannot use the standard unity Tree-Shader.
     
  2. BakeMyCake

    BakeMyCake

    Joined:
    May 8, 2017
    Posts:
    175
    What is holding you back from doing it the way you've described? Is it difficult because of your custom hierarchy? I haven't tried myself, but I'd imagine that a tree imported with a skeleton can be animated to sway without much hassle, but it will have an impact on the fps if there is a significant number of them in the scene.

    The book of the dead demo managed a lot of bendy trees that reacted to wind. It was done in a custom shader, without animations. You can see examples in the wind section of this blog post:
    https://blogs.unity3d.com/2018/06/2...ene-building-and-content-optimization-tricks/

    All the black magic for that demo can be downloaded here https://assetstore.unity.com/packag...-projects/book-of-the-dead-environment-121175
    Based on what people say most of it is broken in the newer versions of Unity, but you still have the wind-related vertex displacement shader code that you can examine and port to your project.