Change the shader in the Material Inspector.
There are two shaders available, so choose the one that suits your needs.
Double-Sided Lighing & Shaking
fk/fkGrassDoubleSidedStandard2
Only Shaking (Single-Sided Lighting)
fk/fkGrassSingleSidedStandard2
Next, configure each parameter.
This explanation uses the double-sided version inspector.
The single-sided version inspector is identical to the double-sided version except that it lacks settings for the reverse side.
This block contains parameters related to lighting.
Parameters can be set separately for the front and back surfaces.
If you want to use the same settings for both sides
—for example, if you want to use the same MainColor texture on both sides—
simply assign the same texture to both.
Parameters that allow setting both a texture and a value (color) multiply the texture and the value. For items you want to set using only the value in the Inspector without using a texture, simply leave the texture set to None and set the value.
To set only the texture, set the Inspector value to 1.0.
For color, set it to white (1.0, 1.0, 1.0).
With this setting, the texture will be multiplied by 1.0, effectively ignoring the Inspector value.
Main Color
Base color. You can set the texture and color.
The texture and color are multiplied.
Alpha Cutoff
This is the threshold for “cutting out” objects using the alpha value of the texture. The alpha value of the texture assigned to Main Color (Front Face) is used.
Normal Map
This is the normal map. If you don't use it, you can leave it as None.
Emission Color
This is the emission color. You can set the texture and color.
The texture and color are multiplied.
MSO Map
Metallic, Smoothness, and Occlusion texture maps.
The R channel represents Metallic, the G channel represents Smoothness,
and the B channel represents Occlusion.
The texture values and slider values are multiplied.
Metallic
The higher the value, the more metallic the texture becomes.
Smoothness
The larger the value, the smoother it becomes.
Occlusion
The smaller the value, the less the effect of indirect light,
resulting in darker shadows.
Parameters related to shaking.
Weight Map
This texture is used to define the parts that shake and the parts that remain stationary. Only the R channel is used. Think of this as a weight applied to vertex displacement by the shader. A value of 1.0 applies 100% displacement, 0.5 applies 50%, and 0.0 applies none at all.
Check Use VertexColor.red as Weight to use the R channel of the vertex color as the weight.
Checking Use Height as Weight uses the vertex Y coordinate as the weight. Bottom Height specifies the height where the weight becomes 0, and Top Height specifies the height where it becomes maximum. Negative values can also be set for these.
Note:
Consider these two heights without the GameObject's Transform applied.
For example, if the GameObject's scaling is set to 100, making the height 1.0, then the value to set here is 0.01.
These three weight settings are not intended to be used together, but if used together, they are multiplied.
The figure on the right shows the assigned weights displayed as colors. The vertex colors are set to create a gradient from black (0,0,0) to red (1,0,0) from the base of the grass that should remain still to the tips of the grass that should sway. The leaves have a texture applied that transitions from black to red from the base of the branch to the tip of the leaf.
Note that in this example, the tree trunk and thick branches are not being shaken and use the default Standard shader.
Speed
This is the shake speed. The higher the value, the faster it shakes. Although it is a 2D value, it is unrelated to the direction in world space. For example, increasing only X will not make the shake faster only in a specific direction in world space. You can generally set the X and Y values without worrying too much about their ratio. Objects with different X and Y ratios will shake differently even if they are close together.
Strength
The magnitude of the shaking. Specify in the world space direction.
Wave Density(Global)
This is the density of the fluctuation. In this shader, vertices that are close together in world space will move in a somewhat coordinated manner. However, increasing this parameter makes it more likely that even nearby vertices will move differently. Setting it to 0 causes all vertices to move identically. (Note that the Weight Map effect remains active.)
If you make it too large, the object will exhibit a wavy motion, so adjust the Wave Density (Local) accordingly.
Wave Density (Local)
This is the density of fluctuations within an object.
Lowering this value causes vertices within the same object to move in unison. Setting it to 0 causes all vertices within the same object to move identically (though the Weight Map's effect remains active).
Even in this case, if Global is not set to 0, different objects will still move differently.
Randomize Dir
Adds random wobble to the shaking direction.
Dir Range (Degrees)
Specify the swing range from 0° to 180°. Random swaying within this range is applied around the direction defined by Strength.
Dir Noise Density (Global)
When this value is low, vertices that are close together in world space will exhibit similar oscillation patterns. When it is high, even nearby vertices are more likely to exhibit different oscillation patterns.
Dir Noise Density (Local)
Setting it to 0 causes all vertices within the same object to shake in the same direction. Increasing it causes vertices within the same object to shake differently.
Dir Change Speed
This is the speed at which the sway direction changes over time. Setting it to 0 will prevent the sway direction from changing over time. Although it is a 2D value, this is unrelated to the direction in world space. You can generally set the X and Y distribution without worrying too much.
It is the same as the Standard shader. Culling is turned off by default, but you can change it to Back or Front to enable single-sided rendering.