Preparing Realistic Grass in UE4

Nils Arenz talked about his vegetation studies and explained how to produce highly realistic and diverse grass with UE4.

Nils Arenz talked about his vegetation studies and explained how to produce highly realistic and diverse grass with UE4.

Introduction

Hello, my name is Nils Arenz and I am a Junior 3D Environment Artist from Germany. Earlier this year I finished my study in the field of computer graphics and image processing. For my graduation thesis, I developed an application for simulating different avalanche types using the Nvidia PhysX library. The main field of my study was coding C++ and OpenGL, but I was always more interested in doing digital art with the knowledge I gained during my study. As often as possible I participated in game or film art projects at my university and improved my knowledge of the Unreal. After I graduated I had to make the choice: working as a programmer or following my dream and trying to become a 3D Environment Artist. I chose the last one and I am really happy with that decision!

My main fields of interests are designing the nature as detailed and complex as possible but doing this in a very efficient way. My background in coding 3D applications helps me a lot to optimize the designs because I know the math behind all the calculations. Projects I published recently are photoscanned ground landscape materials, photoscanned bark materials and a dynamic and interactive ivy. For the next half of the year, I will focus on creating dynamic wind animated and interactive vegetation.

Vegetation Creation Basics

In my opinion, this splits into five parts. First of all the visual quality has to be very high. A blade of grass or other vegetation parts are not just some green mesh parts. All the pictures of the vegetation I create are scanned in a portable studio out in the woods or at home for the best lighting setup.

Next, you need some kind of wind animation. You simply can’t walk through a forest and see all the vegetation static. That simply doesn’t feel right.

Third, you need some way to interact with the vegetation. If you walk by an ivy branch, the branch should have some interaction with your character.

Your vegetation should be as complex/unique as possible but efficient at the same time. It will not look good if you only use 5 different blades of grass for designing grass clusters. The more different kinds of leaves/blades of grass you have the better the result will look. Plus the more you optimize, the more people will be happy with your designs.

Building Grass

The most common way to implement grass is to arrange the blades of grass side by side in the albedo map and using a big plane to map this to an object. This planes will then be stacked inside each other at different angles. If you look at the grass from the top you will not see the grass blades under you. A better way is to put a smaller plane around each blade of grass and put these blades as a structure. Both ways have two big disadvantages: the quad overdraw and the shader complexity are very high. The only way to reduce them is to model each blade of grass individually so that the opacity of usage is as low as possible. This will also lower the quad overdraw. The downside of this method is that the vertex count is higher than other methods, but I benefited from it. For using the Unreal Engine Pivot Painter Tool 2.0 you need a finer mesh for the wind simulation. Further, the UE4 is using foliage instances what makes the vertex count not that important.

 

1 of 2
1 of 2

Diversifying Grass

Let me guide you through my workflow. Unlike flowers, you can cut grass and it will stay fresh for about one hour. As I live in the country I just go outside and collect a huge pile of grass. Mind that it’s important to choose a high diversity of different kinds of grass. Next, I bring the grass home and put it in a vase. For the best results later you need also to pick out variously looking blades of each kind of grass. You can see this in the picture below. Mind that it’s important to choose a high diversity of different kinds of grass. Next, I bring the grass home and put it in a vase. For the best results later you need also to pick out variously looking blades of each kind of grass.  

1 of 2
1 of 2

For each kind of grass, I picked about 5-10 different unique blades. For the best performance, I packed all of them in one albedo map. In total, I came up with 84 different blades of grass in the texture. Each object got modeled, duplicated multiple times and then transformed into different shapes. So I came up with 150+ different looking blades of grass. The next step was creating grass clusters you can use as foliage brushes. For this asset, I made 82 grass brushes, that provide you with a high foliage variation. The clusters are made by 100-200 grass blades, what brings an average vertex of about 1200 per cluster. The brushes work as object instances, and the vertex count is not that important. Using Unreal Engine you have to add a free transformation in x, y and z axes for about +-20% of the size. This all provides a look that every part of the grass landscape looks completely different.

1 of 2
1 of 2

Due to the low shader complexity and low quad overdraw the performance compared to other grass foliages is higher, even with the higher vertex count. At the moment the LOD is made by the Unreal Engine. I am working on a new implementation, which lowers the vertex count by decreasing the height separations of each grass blade. For testing the performance I made a simple scene and put 30k foliage instances in it. I have GeForce 1070 GTX, the frames between 80 and 120. In the following videos, the performance can be seen pretty well.

Animation

The animation of the grass is the key feature of this asset. The most used animation for grass and foliage movement in the Unreal Engine is the Simple Grass Wind Node. The main function of it is bending the whole cluster. The downside is that the grass blades next to each other have closely the same animation, they bend in the same direction with the same strength. Nevertheless, I used this feature to create a wind rolling effect.

I was not happy with the look of this, so I did some research and discovered the Pivot Painter Tool 2.0. After weeks of trial and error, I managed to master the pipeline creation and control over all parameters. The Pivot Painter Tool put the wind animation on every single blade of grass of the cluster. All the calculations are done in the shader. These transformations of each object are made based on its pivot point. The higher the vertex count the more smooth the animation will be. If you only use a plane with 4 vertex points, the animation will bend the whole plane locked to the pivot point. Now all the objects move completely different but defined by parameters in the same way. Unreal already implemented all important parameters like wind strength, wind direction, bending strength, random wind direction change and a lot more.

Another important step was to vertex paint all the blades of grass individually. The animation will look better if the side leaves move more than the stem of grasses. The downside of this method is that you need an individual material instance for every cluster because you need to tell the material where the pivot points are and in what direction the pivot is pointing. 

 

1 of 2
1 of 2

As you need a unique material instance all the wind parameters can be assigned individually as well. A tall grass cluster will be affected by wind more than cut short grass. Further, you can outsource parameters in a material collection, so you can change the wind direction and other values for all objects in your scene. With this method, you can build some kind of wind engine in your application. With a few clicks, you can now change wind direction, wind power, wind noise and a lot more parameters for your whole vegetation system, what will make your vegetation look super alive.

Future Plans

The grass package is a part of my upcoming foliage essentials pack. It will be a pack with all the plants, flowers, grass and much more stuff for filling your ground nicely. Of course, all elements will have the presented wind animation and optimization. I will split this pack into three parts and a bundle with everything. The first part is grass, which is the most important, it will be a big package. The grass project is already submitted and will be hitting the UE4 Marketplace in about 1-2 weeks from now. Further information will be published on the Unreal Marketplace Forum soon. The next pack will be wild meadow flowers and ground plants that don’t fit in the flower or grass sections. Thee two packs are half finished and will be submitted in about 2 weeks. After this, I planned to do a forest foliage pack, with forest fern, small bushes, small trees and other elements. Here the interaction between the vegetation/wind and the character will be key.

Nils Arenz, 3D Environment Artist

Interview conducted by Kirill Tokarev

Join discussion

Comments 14

  • Nils Arenz

    @Tristan: I studied computergrafics for 5 years. I'm making 3D art now since about half a year fulltime, but I had some experience before that. Its hard to focus on one thing, it took me half a year to understand most of the vegetation creation pipelines. For speeding up your workflow maybe spend a bit time with the megascans library. Making 3D vegetation starts from going outside for photoscanns to profiling your assets. Start with one thing and master this.

    @Maxime: The difference between my technique and Z-passing on distant objects is quiet the same. (- the higher vertex count) I would start using this at about 10-15m+. In this inner radius you are using (mostly high) cascaded shadows, the less the shader complexety in this areas, the less the shader instructions. When I started this project, the polycount was a bit to high. Now I found the best balance between a "lowpoly" mesh and the less possible overdraw. The conclusion of this technique is easily using a slightly higher vertex count on the mesh for reducing the quad overdraw and shader complexity. In matters visual quality a "high poly" plant will allways look better than a blade of grass on a plane.

    0

    Nils Arenz

    ·5 years ago·
  • Maxime Parata

    Hi @Nils, What is the advantage/disadvantage of using your technique, and using the "Mask Material only in early Z pass" option in the project settings? That way we would have no overdraw cost and so we could lower the mesh density.

    0

    Maxime Parata

    ·5 years ago·
  • Tristan

    Hi how long have you been making 3D art and models
    i have started this year and you work is great
    I have learned a lot but no where near your knowledge
    Do you have any suggestions or tips to speed up my workflow and quality. I am also working on a game in ue4 with 2 other people which is going to be a long project and do you have any recommendations on performance and quality
    Would greatly appreciate it
    Thanks

    0

    Tristan

    ·5 years ago·
  • Nils Arenz

    @Utsav singh, Yes. But a kind of lowpoly projection to have the best balance between poly count and alpha/quad overdraw.

    0

    Nils Arenz

    ·5 years ago·
  • Utsav singh

    your shader complexity is low because you used true polygon models instead of just a masked plane to prevent alpha overdraw?

    0

    Utsav singh

    ·5 years ago·
  • Nils Arenz

    @DANIEL m NAJERA, the change with no animation will be very small/close to no change. The Pivot Painter Animation is done in the Vertex shader in real time.

    0

    Nils Arenz

    ·5 years ago·
  • danielmn81

    I wonder if the animation was taken off, what type of perfomance numbers we would gain.

    0

    danielmn81

    ·5 years ago·
  • Nils Arenz

    @ ivan paul ninichuck, I used albedo & normal as textures, for specular & subsurface albedo parameters where used.

    @ igor vagun, after so many comments on doing a 4.16 version I will think about it, atm only a 4.19 is planned

    @ Ryban, the draw call displacement is shown wrong, I linked some new pictures. Drawcalls are at 0.2ms maximum, cause foilage is getting object instanced. The GPU thread is this high cause of the dynamic shadow calulation, what takes about 70%. For the future I think a better LOD implementation would work better.

    0

    Nils Arenz

    ·5 years ago·
  • avengelline

    need this for v4.16 . pls make it happen.

    0

    avengelline

    ·5 years ago·
  • Nils Arenz

    @ ivan paul ninichuck, yes I used Albedo, Normal & AO as Textures. Aswell as Subsurface and Specular derived
    by the Albedo.

    @Ryban: First of all thanks for pointing at the draw thread. I done the test again and like I had in my mind the draw calls where like 0.15ms with 120k instances. This is apparently recorded wrong. Sorry! Cause of the usage of object instances the draw call/poly count is really incidental, but it makes the simulation looks more realistic.
    Here a picture of the real draw calls: https://drive.google.com/open?id=1meTmUYpIHjJByQNgH3gNRoULg_0WiHQN

    The GPU thred is this "high" caused by the dynamic shadow calculation. About 70% of the overall costs come from the dynamic shadow calculation.
    Here is a picture of this aswell: https://drive.google.com/open?id=1cX-E49NKt05AkrkcGqur-F9uaHDpRVQP

    0

    Nils Arenz

    ·5 years ago·

You might also like

We need your consent

We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more