This page will cover the Maya pipeline for getting vegetation assets with touch bending into CRYENGINE.
The touch bending system is used to simulate deforming vegetation. It is required that your geometry should have clean UVs laid out. Touch bending physics relies on simulated joint chains or branches which are marked by locators snapped onto the vertices (and its UVs) of the vegetation geometry, e.g. the leaves. Whenever the leaf geometry (along with its Uvs) is duplicated, the topology has not changed. So, each duplicated leaf can use the same deforming joint chain/branch. This saves you a lot of effort in the rigging process of the leaves/branches.
Pic1: Touch Bending in action (with physics debug info displayed: F10 or p_draw_helper=1)
Source Maya scene with exported CRYENGINE files:
Before you continue with this tutorial, make sure to have read and understood the following:
Make sure to keep the following things in mind while you work on your asset:
For this tutorial, we will be creating our asset in the following directory.
<GameFolder>\Objects\tutorial\vegetation\04\touch_bending\
To begin with, we save our Maya scene to this location. All our exported assets will be saved in there.Some of the textures that we use comes from an existing asset and the location of the existing asset will be provided later in the tutorial.
We will continue with the assumption that you have already created the basics of the asset, since this is not a Maya modeling tutorial. We will begin with preparing the asset ready for CRYENGINE, assigning shaders to the relevant polygons.
You may also use the tutorial scene files from the previous vegetation (detail bending) tutorial. You may mix the detail bending with touch bending which we are going to set up.
As in the previous vegetation tutorials, we must create an empty Material Group and have Maya shaders assigned to it. We need two shaders this time, one for the vegetation and one for the activation proxy mesh. Provide the Material Group and its shader some appropriate names, so you can locate them later using that name. You may want to reduce the opacity of your proxy shader to easily spot it.
Pic2: Material Setup
Your shader with ID 01 is the material for fern leaves. A detailed material setup will be shown in the next tutorial section where we will discuss about the setup in CRYENGINE. You may load these two textures into your color texture map slot for visual feedback in your Maya 3d viewport. The following textures are already provided within the CRYENGINE build:
<Your_Project>\Assets\
objects\natural\bushes\ground_cover_fern\ground_cover_fernbush_diff.tif>
<Your_Project>\Assets\
objects\natural\bushes\ground_cover_fern\ground_cover_fernbush_ddna.tif>
For the activation of touch bending vegetation, we usually create a proxy mesh with a special material. In Maya, we need to add an Extra Attribute to your proxy shader ( ID 02).
Pic3: Proxy shader setup to activate touch bending
Unlike the other physicalization option you might be familiar with, Physicalize: NoCollide, this does not block the player, it only detects if something is inside.
If you still have the CryMayaExporter window open, please click on the Generate Material Files button to export the CRYENGINE *.MTL file.
Pic4: Export Material to CRYENGINE
Since we have the two materials/shaders created, we can step into the process of making geometries:
As already mentioned,
Pic5: One example of a final exportable hierarchy in Maya
Using the provided fern diffuse texture and/or the leaf mesh from the previous vegetation tutorial (detail bending), you can easily model the geometry and layout the fern leaf UVs correctly.
Pic6: A simple leaf mesh
Create three Locators and vertex snap one locator (keep the V key pressed in Maya while moving the Locators) to a vertex on bottom, in the center and on the top of the leaf mesh. Rename the Locators to branch1_1 (bottom), branch1_2 (center), branch1_3 (top). As mentioned before, you must have at least three Locators for the branch spline/bone chain generation. Adding more Locators will improve the deformation, but in most cases, three locators will suffice.
Pic7: vertex snap locators to the mesh vertices and use the "branch#_#" naming convention
You need to duplicate the reference leaf mesh to shape a fern bush. You are allowed to move, rotate and scale the duplicated mesh, as long as you do not change their topology and their UVs. So, you may use any Maya Deformers (Non-Linear deformers, Wire, Lattice, Soft Modification) on the duplicated leaves. In our case, we have only used the three standard transforms.
Pic8: duplicated leaf meshes including their child locators
There are ways to make variations of your reference leaf without losing the benefit of instancing in CRYENGINE:
If you completely break the leaves geometry (remove all the polygons in the middle) for making two separate UV islands, this will also break the touch bending for that leaf.
With these modifications you will lose the performance benefit of instancing from a reference leaf mesh. With these changes you can either create a new branch or your leaf mesh will not get touch bending, it stays static.
Below we will show you some useful examples how you can add more variety to your touch bending vegetation.
Pic9: Example of non-destructive modifications to instancing: deleting faces
Pic10: Example of non-destructive modifications to instancing: standard transforms (transloate/rotate/scale)
Pic11: Example of non-destructive modifications to instancing: Bend deformer & standard transforms (transloate/rotate/scale)
In cases where you want to add texture variations to your leaf, you are forced to make a new reference leaf mesh. If you do not want it to be static, then you need to add new branch#_# locators.
Because of the texture variation, you have to move the UVs to a new texture space. In the provided fern texture map, we have six texture variations. In addition, you may also have to create a new mesh topology andd UVs. Consider creating the branch#_# child locators and parent them under the new reference leaf mesh node. Otherwise, these leaves will not get any touch bending.
Pic12: Example of modifications where you lose instancing: adding more "branch#_#" locators and/or moving UVs
The touch bending uses a proxy geometry to get activated when a AI, the player or any physicalized objects is within its boundary. We have already created a shader with a Physicalize: NoCollide under Extra Attribute. To finish the proxy creation, we will make a box as tight as possible to cover vegetation geometry.
Pic12: Proxy geometry to trigger touch bending physics
In the above picture, note how the touch_bending_proxy geometry is not completely covering all of the leaves. This is on purpose. This is an optimization where we allow the player to get close to the bush, but not activate the leaves with touch bending.
Remember that the player has to enter the tb_proxy to activate the touch bending. This is not a required step, it's optional, but in our practice we found this to be the optimal setup in the asset creation.
To help the bush fit into the scene when we move the vegetation object to a level, it is recommended to move the vegetation up slightly, so that the base of the plant actually sits underneath the terrain. This avoids the possibility of seeing the bottom of the bush hovering in the air.
Pic13: Placing the asset into the scene
As a further optimization within the bush asset, not every leaf should be associated with a branch. In general, we try to aim for around a 50 / 50 mix of physicalized branches and non-physicalized ones. But it all depends on how the asset looks. Preferably the less physicalized branches the better (less CPU load) but you want enough in there to make the asset look realistic and behave nicely. It's based on your judgement on how many leaves you physicalize within the asset.
When you refer about leaf variations, we already mentioned how you can get static leaves without touch bending. You just have to move the UVs of these leaves to a new UV/texture space without creating new branch#_# locators. Make sure when transforming the UVs they match the new fern texture on your map.
Pic14: No touch bending because of different UV coordinates and no branch locators
Go to the Crytek shelf in Maya and run the Tool shelf icon. You can create the cryExportNodes and its groups with this Tool script, or you just create empty groups, name them yourself. Ensure that you have a correctly named cryExportNode_* and a child *_group where the asterisk * is the name of your asset.
We have also included the detail bending feature from the last vegetation tutorial in our final export scene.
Here is an example of how your final asset may look like.
Pic15: Final asset
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 touch bending assets.