This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Adding Impostors to Clutters

Learn how to add impostors to clutters. In this tutorial we will show how to set correct impostors to trees, made with clutters.

Step 1. Adding Clutters to the Scene

Add your clutter to the scene and make it the child of the terrain. We used the foothill pine tree from the vegetation library.

In the Mesh tab of the Clutter set the Visible parameter to 400 for better visibility.

In our case we have set 3 LOD surfaces for trees.

Step 2. Adding Grass Object for Impostors

The next step is to add the grass object for the impostors. It also should be the child of the terrain.

Notice
It is preferable to name grass impostor objects after the clutters, so you would not be confused.

Set the grass object position and rotation to 0.

Impostors with the mesh_base material will appear in the scene:

Step 3. Setting Impostors Parameters

For impostors to be set on clutter objects direct positions, you need to specify the following parameters of the grass object (the Grass tab):

  • Enable the Intersection field.
  • Set the same Mask image as for the clutter.
  • Set the values of the Min value and Max value fields the same as for the clutter.
  • Set the values of the Spawn and Seed fields the same as for the clutter.
  • Set the Density value to 0. After that, you can set the Size X, Size Y and Step parameters.

    The Step parameter of impostors should be bigger than for clutters, but the final generation step should be equal to the clutter's one. Use the Subdivision field for it.

    Notice
    The generation step will remain the same, but the grid will become bigger, which will decrease the number of DIPs and increase performance.
  • After the generation grid size is specified, set the same value for the Density field as for the clutter.
  • Set other parameters (till the Min height) the same as for clutters.
    Notice
    The parameters that have not been set will we set in the next step.

Set the following grass surface parameters in the Surfaces tab:

  • Set the Max parent Visible parameter to 2000.
  • Set the Max parent Fade parameter to 8000.

Step 4. Creating Impostor Material

To create the material for impostors, you need to do the following:

  • Add the tree mesh, that has been used for the clutter, to the scene.

  • Go to the Surfaces tab of the clutter and click Copy. After that, go to the Surfaces tab of the mesh and press Paste.
  • Open the Grabber tool, which is located in the Tools panel -> Grabber tab. Perform the following:
    1. In the Mode field choose the Impostor option.
    2. Specify the Phi, Theta and Aspect value.
    3. Click Grab and specify the path to save the texture into.

    Two textures, diffuse and normal, are generated:

    A Diffuse Texture
    A Normal Texture
  • In the Materials panel inherit the grass_impostor_base material.
  • Assign obtained textures to this material.
  • In the Parameters tab of your impostor material set the following parameters:
    1. In the Impostor field change the transformation parameters in accordance with the set parameters while generating impostor textures (the Phi and the Theta values set in the Grabber tool should match transformation of the impostor along the X and Y axes).
    2. If there are some animation parameters, set for the clutter object material, set the same ones for the impostor.
    3. Set the Shadow value to -3.
    4. Set the Alpha value to 1.3.

  • Adjust other impostor parameters:
    1. Set the same Aspect value as in the Grabber.
    2. Set the Num textures value to 1.
    3. Adjust other parameters until you receive correct impostors positions.

As a result, we have obtained impostors, set almost at the clutter objects positions:

Step 5. Setting Visibility Distances

The last step is to set visibility distances for impostors to be enabled starting at the specified distance:

  • Set the visibility distances for all of the clutter LODs.

  • Set the visibility distances for the impostor starting at the last specified distance of the clutter object.

As you can see at the picture, the distant impostors have been activated:

Last update: 2017-07-03
Build: ()