для этой страницы,
отображается код на другом
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.
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):
- Set the Num textures parameter to 1.
- Enable the Intersection field.
- Set the same Mask image as for the clutter.
Use the 8R textures for the masks to work correctly.
- 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.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.
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:
- In the Mode field choose the Impostor option.
- Specify the Phi, Theta and Aspect value.
- Click Grab and specify the path to save the texture into.
Two textures, diffuse and normal, are generated:A Diffuse TextureA 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:
- 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).
- If there are some animation parameters, set for the clutter object material, set the same ones for the impostor.
- Set the Shadow value to -3.
- Set the Alpha value to 1.3.
- Adjust other impostor parameters:
- Set the same Aspect value as in the Grabber.
- Set the Num textures value to 1.
- 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: