Search Unity

FPS sample animated vegetation

Discussion in 'FPS.Sample Game' started by kirilli40, Apr 30, 2019.

  1. kirilli40

    kirilli40

    Joined:
    Apr 30, 2019
    Posts:
    4
    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?
     
  2. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    217
    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.
     
  3. kirilli40

    kirilli40

    Joined:
    Apr 30, 2019
    Posts:
    4
    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?
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  5. kirilli40

    kirilli40

    Joined:
    Apr 30, 2019
    Posts:
    4
    Do you know if in the sample they are baking that animation in the materials somehow?
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    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.
     
  7. kirilli40

    kirilli40

    Joined:
    Apr 30, 2019
    Posts:
    4
    Sounds good thank you.
     
  8. karstenv

    karstenv

    Joined:
    Jan 12, 2014
    Posts:
    81
    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.
     
    ManaWorksKirill likes this.