Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

How to make swaying trees with DrawMeshInstanced?

Discussion in 'General Graphics' started by JoeStrout, Mar 23, 2019.

  1. JoeStrout


    Jan 14, 2011
    I'm need to make a forest scene (on Oculus Go). DrawMeshInstanced looks like a promising way to draw a lot of trees, grass, and bushes in just a few draw calls.

    But real plants sway in the breeze; they are not solid and static like statues.

    How would I go about making my meshes sway while using DrawMeshInstanced? Is this a job for vertex displacement? Perhaps I could use vertex color or a second UV set to control how much each vertex sways (for solid trunk but swaying branches, etc.), and use some sort of noise function combined with time to make the ripples propagate across the scene?

    Please let me know if I'm on the right track. And if there is an off-the-shelf shader already available that does this, please point it out (I'm not proud!).

    - Joe
  2. LennartJohansen


    Dec 1, 2014
    JoeStrout likes this.