FPS sample animated vegetation

How is the vertex animation done in the FPS sample animated vegetation? I see it’s using the standard unlit material and yet leaves are moving. Where are the settings or properties that allow for this?

There are a few different things they use. Depends what part you’re talking about. Flower Alien Big A Rigged is basically an animated model with rigs / skeletons and anchors. Others use rope line and line renderer and stuff. Check the children and what components are attached to them.

Im looking at this plant:

It’s using the Lit material.

Does anyone know where in the lit material are the options/properties/settings for defining the vertex position animation? These plants have a nice wiggle at the top and are locked at the bottom so they must be using vertex colors but when I look at the vertex colors channel it’s just solid white color.

What is controlling the masking and the rate/amplitude of animation?

As far as I know Unity doesn’t want wind being coded into the main lit shader any more so the correct approach would be to use shader graph with a lit master node.

Do you know if in the sample they are baking that animation in the materials somehow?

This is a common and well understood workflow, where various attributes such as how much it can bend is often baked into vertex colours of the actual mesh. For the sake of example, red might contain a value between 0 and 1. This is is read in the shader which then knows how bendy it can be by multiplying it. For example 1 = max bendy.

You can find examples for grass bending shaders and so on all over the place, including above links, so if Unity didn’t rig the plant in the FPS sample, then yes, they baked some data into the mesh verts since there is no other practical approach in game dev for plants.

Sometimes developers choose to have both, for example in Uncharted 4 and GTA V, characters are rigged but the clothing will also bend and flap a little in wind via vertex animation.

The issue here is the FPS sample may be using an older / modified version of HDRP (I haven’t time to check) where wind was an exposed parameter within the HDRP lit shader.

This is not available now in current HDRP so you will use the shader graph to restore the functionality.

Sounds good thank you.

You can expose the wind settings in the lit shader by switching to debug mode.
…or use the a duplicate of the material they have used for their plants.

1 Like