Hey guys, heres the breakdown for the grass that some people have been asking about.
This same method is used for other foliage too, like the trees, plants, bushes, etc.
There is a few key things you must do to get this right:
• Make sure the grass normals are all pointing up.
• Create a grass texture used on the grass and landscape materials.
• When painting the mesh onto the landscape, align the mesh to the landscape normals.
Here is a small example of what you can expect of your grass or other foliage:
Notice the nice blending and shading from the landscape. This is due to the actual vertex normals of the grass. If we modify the vertex normals to point upwards, this helps with this blending effect, which in the end is key to getting the grass smooth as possible.
In 3ds Max, the grass normals are represented by green lines; they should look like the above the image when you have all of them pointing upwards.
In order to create the proper effect of blending between the grass and actual landscape material/component, they both need to use the same texture and base diffuse material setup. This same method was actually first made by ZacD I believe as I found it over on a reddit post of his a while back, but I’ll cover it again in some more detail. Overall, this is a very easy effect to generate.
Here is the default green grass texture I use. You can make this simply by painting it in photoshop or just finding a grass texture online and applying a gaussian blur filter to it. In my case I did both to find something suitable.
Create 2 new materials: One for your landscape, and one to be applied to the grass mesh.
In both, create the following material node setup and connect it to the diffuse input of the material:
The texture samples are samples from the new diffuse texture we imported. By making them parameters you can easily change the colors or textures and easily create new looking landscapes by using material instances. We will also need to use the material function AbsoluteWorldPosition(), which lines them up to the same spots for the blending.
In the grass mesh material, we next apply a simple 0,0,1 vector, which ensures that all texture normals point upwards as well.
Again, this helps blending between the grass mesh and the landscape component.
In your material settings for the grass mesh material, make sure to disable “Tangent Space Normal” (see last pic).
Lastly, apply your new landscape material to your landscape, and the grass mesh material to the grass mesh. I also recommend disabling dynamic shadows from the grass mesh to improve performance and improve the overall stylized look. I do this on some other foliage as well, largely depending on its size.
The last step that we must do is the paint the grass onto the landscape.
A few things I make sure I do here is align the grass to normals, disable dynamic shadows, and make sure its density is between 150-200. The nice part about this grass mesh and material is that it seamlessly blends between itself and the landscape, so you can fade it out relatively closely to the player without them noticing. You also don’t need it very dense, as again, it’s not super noticeable.
Final outcome:
The biggest things to remember when creating this sort of effect is to use normals that all point up and to use the AbsoluteWorldPosition() function for your texture UV’s, so the grass and landscape texture will tile in the same way across your levels.
Lastly, I didn’t shown the entire material inside the actual breakdown, but here it is anyway if you want to see some other bits of it (basically just wind, opacity, etc).
Hope this helps someone! I think I will probably make a blog soon so I can keep posting long breakdowns like this on it. On that same note, if anyone wants to see something else specifically or has a question, let me know!