In this tutorial, we will be using our Merged Mesh system and show you the process of how to setup bendable grass blades. Merged Meshes are mainly used to handle areas with dense numbers of vegetation objects like big fields of grass. Merged Meshes also allow the usage of a rope based bending effect. Ropes get generated for each asset instance that bends upon impact.
Contrary to bone based setups like Touch Bending, ropes can be cheaper and get affected through the global wind and our Breeze Generation system. Large fields of grass are perfect examples to showcase this type of technology since each asset instance can be merged into bigger clusters through the merged mesh system. So for this tutorial, we will create two simple grass plane assets as a base for a dense overgrown grass field.
Pic1: Dense grass field affected through wind
Pic2: 2 assets that this entire grass field contains
Source 3dsMax scene with exported CRYENGINE files:
Before you continue with this tutorial, make sure to have read and understood the following topics;
Make sure to keep the following things in mind while you work on your asset:
Merged Meshes has some improvements but also some missing features compared to Touch Bending. This table gives you an overview about the differences between those two systems. Use this to decide which type of feature works best for your asset.
Description | Merged Mesh | Touch Bending |
---|---|---|
Type of bending | Ropes | Bones |
Instance merging to clusters | Yes | No |
Influenced by Wind | Yes | No |
Influenced by Breeze gen | Yes | No |
Requires simplified geometry (low poly count) | No | Yes |
Bone parenting support | No | Yes |
Proxy support | No | Yes |
UV instancing for bones | No | Yes |
For this tutorial, we will be creating our asset in the following directory.
<Your_Project>\Assets\
Objects\tutorial\vegetation\02\grass\merged_mesh\
So to begin with, save your max scene to this location. All our exported assets will be saved in there. Some of the textures which we use will come from an already existing asset and we will point you to the directory where they are later in this tutorial.
We will continue with the assumption that you have already created the asset, since this is not a 3dsMax modeling tutorial. We will begin with preparing the asset ready for CRYENGINE, assigning SubIds to the relevant polygons and configuring the material.
Pic3: 3dsMax overview of the finished model
First, we will configure the material for the object. In 3dsMax, open the Material Editor, and create a new Multi-SubObject material with one SubId called tutorial_merged_mesh
Even though, we are using one material SubID, it is better if you follow the standard convention with all our other asset setups, of using a Multi-SubObject material.
Load in your diffuse map which should contain an alpha channel for the opacity.
The example file refers to the following provided tutorial texture:
<Your_Project>\Assets\
objects\tutorial\vegetation\02\grass\merged_mesh\tutorial_merged_mesh_diff.tif
>
Pic3a: Shader parameters setup
In the SubID for the material:
Now, we have configured the material for the object with its standard properties.
<Your_Project>\Assets\
Objects\tutorial\vegetation\02\grass\merged_mesh\tutorial_merged_mesh.mtl>
Pic4: Select the material to export and make sure you are at the top level, not inside a SubID
Our geometry for this tutorial is going to be two patches of grass blades. Keep in mind that we will place several hundred thousand instances of those two assets throughout our scene so keep your triangle count as low as possible.
Create a single plane mesh for your first grass patch, divide up the shape into a similar polygon configuration (and assign ID1), and apply the material that we have just created to it (tutorial_merged_mesh.mtl). Use the Unwrap UVW modifier to adjust its UV shell to only fit around one of the grass patches on the texture. Create a copy of your mesh and move its UV shell to a different grass patch through another Unwrap UVW modifier (See Pic5 and Pic6).
Adapt the shape of both meshes to their applied textures. Finally name your 2 grass objects as:
Pic5: Geometry of the grass patches
Pic6: UV Layout of both grass meshes in 3dsMax. Note the grass UVs are matching the underlying texture
Next let us add the dummies so that our grass can bend in the wind. Dummies are necessary for us to define a start, mid and end point of our rope chain. Create three dummies for both assets. Align them to the surface and place them roughly at the bottom, in the middle and the end of your grass geometry.
Using the same naming convention as the Touch Bending system, name the dummies as follows;
Note how we do not have to snap the dummies exactly onto a vertex like the touch bending setup. You can if you want, but it is not required by the Merged Mesh system.
Pic7: Geometry of the grass patches with aligned dummies
Next, open up the Schematic view and link both sets of dummies to their corresponding geometry. Make sure the correct branch chain is connected to the right geometry, since we are dealing with two assets at once here.
Pic8: Schematic view of the assets hierarchy
We are now ready to export our geometry to the engine. In the CRYENGINE exporter:
Pic9: Adding the asset to the exporter
Pic10: Successful export
We have now finished the setup for the 3dsMax portion of the tutorial. To continue, move to the next page where we configure the material and use the Vegetation Tool to place down some of these Merged Mesh assets.