Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This tutorial takes you through the process of creating the simplest vegetation asset; grass patches. It covers the basics of the vegetation shader parameters and introduces you to the Vegetation Editor in CRYENGINE. Grass patches is the former method that we used to create grass assets for the ENGINE. Even though this method is still valid and worth knowing, our preferred method for creating grass is to use the Merged Mesh (MM) technology. 

Image Added
Pic1: Finished scene using grass patches.Image Removed

The below example (Pic2) depicts the creation of grass patches using the vegetation Editor. The one on the right is shown in a highlighted planes view.

Image Added
Pic2: Grass  Grass objects in normal and highlighted planes view.Image Removed

Table of Contents
maxLevel3
minLevel2

...

Before you continue with this tutorial, make sure to have read and understood the following topics:

...

Info

You can add a proxy to the object, but it is not recommended for grass patches.

Image Added
Pic3: Material setup in 3dsMax, left is the top level of the multi-material, on the right the SubID's properties.

Image Removed

Default settings for the SubID's properties in the Material Editor

...

  • Diffuse = 255,255,255 
  • Specular between the 40,40,40 -> 60,60,60 range

     


The example file refers to the following texture that is already provided within the build. Link to this in the Diffuse Color map:

...

Now we have configured the material for the object with one SubID.

Image Added
Pic4: Selecting  Selecting the top level of the material (not a SubID) to export.Image Removed

Ensure you follow the following prerequisites: 

...

  1. Create a polygon plane and apply the material tutorial_grass_patch to it.
  2. Make sure that the SubID is set to ID 1.
  3. Name the polygon object tutorial_grass_patch.
  4. Use the Unwrap UVW modifier to adjust your UV shell to only fit around one of the grass patches on the texture.

    Image Added
    Pic5: Arrange the UVs of the polygons to fit one of the grass textures.Image Removed
  5. Using this setup, duplicate the polygons and distribute them around the area which you would like the patch to cover. Apply random rotation and scale to the patch to break up the uniformity of the object (Make sure you do not over modify which may start to stretch the textures).
  6. Try to end up with a rough hexagon shape for the entire patch. This works the best in most situations.

    Image Added Image Added
    Image AddedImage Added
    Pic: 6, 7, 8, 9: Example grass patch geometry build up.
    Image Removed Image Removed
    Image RemovedImage Removed
  7. After you have finished the geometry distribution attach all the individual planes together into a single base object (tutorial_grass_patch).

...

Make sure that the pivot of the object is roughly in the center and slightly up from the absolute bottom of the object. This slight vertical offset of the pivot allows the geometry to be slightly sunken into the floor which is useful in aligning according to the terrain function in the Vegetation Editor. When used in this way, it will average out (as best it can) to fit with the variation in terrain height. This helps to avoid a gap underneath the grass patch and prevents it floating in space. 

 


Note

Make sure you do not set the pivot too high, otherwise you will lose the bottom of the geometry into the terrain.


 Image Added
Pic10: Pivot location slightly higher than the base of the object.

Image Removed

Apply Vertex Color (to control material Vertex Deformation)

...

Inside 3dsMax, configure the asset to display the vertex colors. Right click on the model and select Object Properties. Enable the checkbox to display vertex channel display and ensure that vertex color is selected from the drop down list.

Image Added
Pic11: Enabling vertex color display on the asset.Image Removed

With the asset selected, add a vertex paint modifier to the stack. 

Tip
To help visualize where you are assigning colors to, apply a different standard material (a spare empty material with the flat grey color) to better see colors on the vertices. However, do not forget to return it to the correct material after you have finished the vertex painting.


Image Added
Pic12: Apply the vertex colors, black = no movement, white = maximum movement.Image Removed

Process for applying vertex colors:

...

  • Use the $LOD prefix to the LOD's name (e.g. $LOD1, $LOD2 etc...). The naming convention of $LODxxx to inform the Engine that this is an LOD.
  • Try to reduce the polygon count by approximately 50% per LOD step (if possible) while still preserving the overall shape.

Image Added
Pic13: Overview of the LOD chain.
Image Removed

In this example, we are using two LOD's for this asset. The naming convention and polygon count are as follows.

NameLODDescriptionPolygon Count
tutorial_grass_patchLOD0Main mesh you'll see up close652
$LOD1_tutorial_grass_patchLOD1First LOD412
$LOD2_tutorial_grass_patchLOD2Second LOD212

Note, there is an approximate 50% drop in polygons as we step down the LOD chain. It is not a hard rule to follow, but we recommend you to aim for that level of optimization when switching LOD's. It is of course down to a per-asset basis as to how many polygons you can safely remove without destroying the look of the asset.

When you link the LOD's to the parent object (dummy helper or in this instance the main mesh) all the LOD's must connect directly to the parent.

Image Added
Pic14: Schematic view of the hierarchy that all LOD's are siblings of each other and linked to the parent.Image Removed

Export the Geometry

We are now ready to export our geometry to the Engine.

...

  1. Add the root node of the geometry asset to the export list (in this case it is called "tutorial_grass_patch").
  2. Select 'Geometry (*.cgf)' from the Export format drop down list. 
  3. Press the Export Nodes button.


Image Added
Pic15: Exporting the asset.
Image Removed

 Image Added
Pic16: Successful export log. Image Removed

Continue to CRYENGINE

We have now finished the setup for the 3dsMax portion of the tutorial. To continue, move onto the next page where we configure the material and use the Vegetation Editor to place down some grass assets.

 

Vegetation 01 Grass (Patch) CRYENGINE