Page 1 of 1

Questions about the grass in SimpleTerrain example

PostPosted: Sat Jan 26, 2019 4:04 pm
by mrmongbat
I extracted the ApplyGrass file in the SimpleTerrain scene and was trying to understand how it worked but I'm quite confused.

https://youtu.be/-ApIv8w52Zk

Is this how it should work or am I doing something wrong? The Windzone direction doesn't seem to be affecting it very much, for example the grass in the upper left corner never seems to move much however I spin the Windzone?

I'm also wondering how I would use the wind variables in a new scene.
I tried creating a completely new scene, created a Windzone object and applied the material to a test mesh, in that scene nothing happens at all.

I also tried creating a new amplify shader and copying the vertex offset node-chain from the GrassBlades shader and applying to my test mesh in the new scene without any success, nothing happens, it's like the Windzone object doesn't exist in that scene.

Do I need to link the Windzone object to the shader somehow to get it to be affected by it?

Apologies for probably missing something quite simple :oops:, any help would be appreciated.

Re: Questions about the grass in SimpleTerrain example

PostPosted: Mon Jan 28, 2019 5:04 pm
by Amplify_Borba
Hello!

In this sample we've added the custom shaded grass as a tree prefab, so that it can use a custom ASE shader that allows you to access Unity's wind zone.

Image

We've added the grass for this sample as a tree prefab since the alternative would be to override Unity's grass shader, which we don't recommend due to the lack of flexibility and also since, in our case, it could override users' own custom grass implementations.

In order to properly replace Unity's grass, you'll have to follow the steps shared in this post.

Regarding the wind zone behavior, I'm not too familiar with it but according to tests that we've ran before it seems to be behaving as expected. Having it set to Directional has it influence the whole terrain, and you'll need to tweak its parameters, as well as the shader itself, in order to see different results.

Please let me know if this helps.