- Home /
Wind: Detail meshes are moved by wind back and forth, rather than swaying: how do I make them sway?
I made a terrain, painted it with some splat textures, then moved on to add some swaying grass. When using a "small bush" from the Unity package of foliage under resources just to test with, I noticed that once the area was previewed or run as a full app, that the grass would MOVE left/right instead of just tilting left/right to give it a swaying effect. How do I make the grass/other detail meshes sway/rotate slightly with the breeze, rather than being physically moved back/forth?
Answer by ZeoBuzz · May 09, 2010 at 02:39 AM
I needed to paint them as "detail textures" instead of "detail meshes" to achieve the desired swaying behavior. User error =P.
You should accept your answer as being the correct one.
Glad you figured it out. :)
that's not really a solution, since this means you can't have bushes and stuff (as they're meshes rather than just planes), unless you turn of the wind completely
Yes you can, but they have to be trees. To clarify, ZeoBuzz is talking about http://unity3d.com/support/documentation/Components/terrain-Grass.html
The issue is not with the 2D texture billboards, but with detail meshes. If I use a detail mesh with the render mode set to 'grass' it will move incorrectly.
Yeah this is misleading. In a sense, the answer has NOT been solved. Detail meshes are in fact still broken under Grass rendering mode.
Technically the solution is to not use Grass rendering mode at all, but ins$$anonymous$$d set the rendering mode to VertexLit.
Answer by God-at-play · Sep 29, 2011 at 07:05 PM
I just saw a forum post that mentioned that detail meshes should have the vertex color alpha painted to determine how much wind affects them.
So the official solution is to paint your vertex color alpha black at the bottom, and then some value at the top depending on much wind should affect it.
This seems to be a documentation bug in the Detail Mesh reference page.
God at play is perfectly right, change the alpha on the vertex colors on your mesh, 0% no movement us at base and ramp up to about 60-75% for the top vertex's which are effected by the wind,, then re-import, remember to refresh your model import and re-assign the prefab to the detail mesh under grass.
So surprising that after 9 years, the manual still fails to mention this.
Answer by KevalrOxy · Jul 02, 2017 at 03:22 PM
For anybody trying to solve this probelm... here is a youtube video showing a fix, step by step...
I can confirm that this video mentioned above explains the process for making Detail Meshes react to wind correctly. https://www.youtube.com/watch?v=1QbpCZuGe7M
~~~~~~~~~~
I used Maya 2017 instead of 3DSMax.
So here is my detailed Maya instructions for the process of painting the "wind weights" for a Detail Mesh:
~~~~~~~~~~
I made 2 quads, and set them up as a cross of meshes to be the grass or bush.
~~~~~~~~~~
Then I used the "Split Selected Edge Ring" tool to add another ring of edges around the middle (so I could have different wind swaying values at the bottom, middle and the top.
~~~~~~~~~~
I then selected all the bottom verts and went to Mesh Display > Apply Color.
~~~~~~~~~~
I selected the "options box" for that entry in the menu (click on the "box" icon on the right of the menu item itself).
TIP: You can add this Apply Color tool to the the tools Shelf. Press Shift+Ctrl+RightClick on Apply Color to add it to the tools shelf.
~~~~~~~~~~
I then set the Color to white (which will how bright the texture itself is in the scene. (You may want to use an off white, grey, etc). And most importantly, set the Alpha to 0.0.
~~~~~~~~~~
The bottom of my grass should not sway in the wind at all. This is where it is attached to the ground!
~~~~~~~~~~
I then select the middle row of verts, and paint them at Alpha 0.35 or so.
Note: Click "Apply Color" button while you have the relevant verts selected - you'll see the viewport update to reflect your values.
~~~~~~~~~~
I then select the top row of verts (at the "tips of the grass model"), and paint them with weight 1.0, to make them sway in the wind at full force. Hit Apply Color.
Note: You can use 0.8, o.6 or whatever suits you, if you want them to now sway as much in the wind.
~~~~~~~~~~
Making a firm tree with windy branches or leaves
You can add more or less detail into your mesh, to control the different weightings and how your model will be affected by wind in Unity.
You can also do more diverse things (as mentioned in the video) like:
Model a vine stalk (with Alpha = 0.0, so it doesn't move at all.
Then add leaf models to the stalk. And make the leaf wind weights get more sway as they extend from the stalk.
~~~~~~~~~~
Answer by danilec1313 · Jan 28 at 08:46 AM
Hi! I created a free asset in Assets Store that let's you to prepare any mesh to be used in Unity Terrain as a detail mesh with a correct wind behavior: https://assetstore.unity.com/packages/slug/210986
Answer by glowingslab · Jul 01, 2011 at 11:42 AM
I have this problem too. As Steven 1 points out, is there a way to make the plants sway instead of moving?
Are you following http://unity3d.com/support/documentation/Components/terrain-Grass.html ?
Is there a solution to this - I love the look of the Terrain Detail grass renderer but the sway is uncontrollable. is there a way to control this by code? It rocks back and forth (root to leaf) even if you dont have wind setup in the scene. Or is there a way to get a similarly selectable dual colored render for terrain grass by some other means?