What makes more sense? Animation or Vertex shader for environment bushes?

I have some bushes in my environment and when the player touches them they move a little bit.

Right now I have a vertex shader which, when the player touches the bush, makes the bush wiggle a bit. BUT, this creates a separate material instance for every single bush.

I’m wondering if it would be more performant to have the bushes use the same material and just add an animator which handles the bush movement instead?

Any recommendations here are welcome!
Thanks!

1 Like

i see your point , i hope this clears up any confusion

Definitely the vertex shader approach , as for the material instantiation thing you can avoid it by rendering your bushes using a “DrawInstanced” command or by ticking the “GPU instancing” toggle on the material , more info here.
Also , use the frame debugger to be sure that the batching is happening correctly

Ah excellent! Thanks for pointing me in the right direction, this makes perfect sense!

Wait, does this work with shaders created in the shadergraph? (Built-In)

Yep , you have the “GPU instancing” toggle in shadergraph too

Am I blind? I just can’t find it lol, couldn’t find it on google either. I hate to be annoying but please where is the button?? :joy: :sob:

Sure , here’s a screenshot of a material using a shadergraph shader

I think you need more arrows to make it clearer.

Lol :rofl:
This is what I see:


Are you sure you are using Built In when doing this experiment?

Weird, it seems to be hidden for built-in, but you can find it by toggling Debug mode in the inspector like this :


1 Like

Ah! That old chestnut. Thanks a lot for taking the time to help out, I really appreciate it. Thank you!! :slight_smile: :partying_face:

1 Like