Hi, i decide to share with you guys two shaders I wrote for moving foliage outside of the unity terrain, one for the leaves based on the Standard Surface Shader, with metallic and smoothness, and a simplified one for grass, whitout the GI thing, but you can use one of them in both cases. The part of the shader corresponding to the motion I took from here. Thanks, GambinoInd!
The idea is to make it easier for anyone looking for a shader that lets your own trees look more pleasing, since the built-in tree soft occlusion leaves does not have many options(haha), and make wave grass moviment outside the terrain.
Unfortunately I did not find any solution to move the bark, if any of you could help it would be very good. By the way, this is the first interesting shader that I implement, do not crucify me if you find some grotesque mistake and sorry for my bad english!
might want to add the codes in the repo not only a packages, to make it easier for people check your code without need to download and import the packages in unity
Thank you very much for this! I see the examples and it looks great!
However, what are the reqruirement for the models, such as the tree models? The low poly tree has two materials, one for the top, and one for the bottom, where only the top one has the shader applied. GIF here https://cl.ly/3e2p2p0F4410
Sorry for the too late answer. Everything needs to be a single object with two materials(leaves and bark), like the setup in documentation for custom trees.
wow, thanks a lot! This is exactely what i wanted. Our game features small outside places, like a backyard or a small meadow, so a terrain would be total overkill but we still need some movement in our grass.
perfect, as said thanks a lot!!!
If you want any credit, when the game is done, pm me.
thanks for this nice foliage shader. I Looks very interesting!
I am trying to use it with a texture Atlas: I have 8x8 gras textures on one texture.
I have different gras meshes. each one has 4-16 surfaces which Point on one of those gras textures.
It works and Looks very good with your shader, but it does not move (at all). I added a Windzone but still no movement.
Is there a way to get the grass moving using a texture Atlas and many different meshes for each gras on that Atlas?
With a wind Zone or it would also be okay for me just to get each one Swinging randomly?
It will not work with a texture atlas, not as expected at least. This shader is based in the old built-in solution for moving grass in unity terrain and it was made to only support a single texture per image file. To be able to move it using a texture atlas you’ll need to use a solution based in vertex colors, so the information of the vertices that should move or not will be stored in the mesh itself, not in the texture. It may work with this shader, you’ll need to dig into vertex colors. I’ve code a better solution for it, with proper vertex color implementation, but I think unity itself already have a solution for vegetation, so you should use theirs.