From NeoAxis 3D Engine Wiki
|Language:||English • Russian||Status:||Approved|
This manager of decorative objects is designed for easy creation and deployment of large arrays of decorative map objects such as grass, flowers, rocks and stuff. With it you can easily paint large amounts of vegetation. This editor doesn't support the creation of physical collisions for created objects.
Working with the editor
Using this editor you can apply decorative objects on virtually any surface, whether it is a terrain or a static mesh. Most of the time you will be applying them for Terrain though. To add the editor to your map you need to select the DecorativeObjectManager.type type in the object creation window of the map editor and click the left mouse button in the workspace.
After you select the editor, there will be a series of buttons at the bottom of the properties window to work with the Manager.
Before you begin drawing, you must specify the list of objects to placed decorative objects on. Click the Collision button under the properties window.
To add a map object to the list of intersection objects, click the "Select / Deselect" button and select the object in the workspace of the editor. Repeating the same steps will remove the object from the list.
Also, in this window there is the "Add All Object On Map" button. It allows you adding all supported objects to the intersection list.
The "Clear All" button clears the list of intersection objects.
Adding decorative elements
The main work with the editor of decorative objects begins with clicking Edit under the properties window.
Before you start drawing, select the (Tool) in the opened window, set the radius (Radius) and the strenth (Strength), then choose the type of a decorative object.
There are 6 decorative objects in the SDK:
- DecorativeStones — stones,
- Ear — ears,
- FlowerWhite — white flowers,
- FlowerYellow — yellow flowers,
- GrassGreen — green grass,
- GrassBrown — brown grass.
Once the brush is configured, you can proceed directly to the drawing. To do this, hold down the left mouse button and place decorative objects in the workspace.
Removing decorative elements
To delete the selected type of decorative objects, you need to change the tool to Clear in the decorative objects window. Further actions are similar to the process described above. Hold down the left mouse button and move the cursor over the areas you want to remove decorative objects from. The cleaning tool erases the currently selected object type only.
Tip: To quickly switch between painting (Paint) and deleting (Clear) of objects, use the "'Shift"' key.
The list of decorative objects on the map
In the decorative objects window, there is the Created tab, it holds the list of created objects.
This tab displays a list of all decorative objects placed on the map, and their count. All objects are grouped by type.
By selecting a group of objects and pressing one of the buttons, you can perform one of the following:
- Update — randomly change the size, position and rotation of objects of the selected type,
- Delete All — delete all objects of the selected type.
To draw decorative objects on the map the decorative object manager uses previously created objects of the DecorativeObject class. As we said above, the engine already has a number of ready-to-use types of decorative objects — grass, stones and others. To create new and edit available decorative objects use the Resource Editor.
You can learn how to create your own decorative object types in the tutorial below.
All decorative objects are found in the "Data\Types\DecorativeObjects" folder.
Decorative objects include the following resources:
- type (.type) holding the settings of the decorative object,
- 3D models (.mesh),
- materials (.highMaterial),
Essentially, a decorative object type is a collection of 3D models. When you draw, one of 3D models is selected at random and placed on the map
Properties of the decorative object type
Decorative objects have the following properties:
|BatchSize||The size of the generated objects group. The option is used by the graphics card.|
|CastShadows||Enable/disable casting shadows by decorative objects. If set to True, then the model will cast shadows.
Note: a large number of objects casting shadows significantly reduces performance. This option should be used with caution.
|DestroyBatchOnDistance||Enable/disable removal of objects located at a great distance from the camera. If set to True, then a group of objects that are not visible at the moment is unloaded from memory and is only created if the group enters the scope. Using this option helps reducing memory consumption.|
|DistanceBetweenObjects||The minimum distance between neighboring objects placed on the map.|
|Items||A set of 3D models. Items of the list are described below.|
|ScaleRange||The zoom range. It allows you to set the zoom range for objects placed on the map. If you set the value of 1 1', all objects will have the same size as the original model.|
|StoreObjectsPositionInVertices||Enable/disable adding to the geometry of objects a channel with positions of decorative objects. Then these data are used for the material of the vegetation (VegetationMaterial) to implement the effect of shaking on the wind. Positions are stored in the vertice channel — Semantic: TextureCoordinates, Index: 4.|
|VisibilityDistance||The distance of visibility. Objects that are beyond the specified distance from the camera are not drawn. If the value is 0, the object is always drawn.|
|AllowEmptyName||Whether the entity can has an empty name.|
|ClassInfo||The class information of type.|
|CreatebleInMapEditor||Whether the entity can created in the Map Editor.|
|Name||The name of type.|
|NetworkType||The network type of entity. Allow to choose one of the following values: NotSynchronized (not synchronized), ClientOnly (synchronized on the client only), ServerOnly (syncrhonized on the server only), Synchonized (completely synchronized).|
Properties of 3D model of a decorative object
3D models associated with this type of decorative objects should be listed in the Items list. To edit the list, click "..." next to the field.
Items are added to the list with the Add button and are deleted with the Remove button.
Every item has the following properties:
|MeshName||The name of the file of a 3D model.|
|Probability||The probability this model appears among others when adding decorative features to the map. The default value is 1. The higher the value, the higher the probability of generation of this model is.|
Tutorial - creating new types of decorative objects
This tutorial shows how to create new types of decorative objects.
Before you begin creating a new type, you must prepare a whole group of resources, in particular:
- 3D models,
In this tutorial we use resources already available in the decorative object engine — DecorativeStones. We slightly adjust the texture, giving it a red tint. This way we create a new type type of red decorative stones that are suitable for fantastic scenery.
Note that the available types of decorative objects and their resources are located in the "Data\Types\DecorativeObjects" folder. We recommend placing new types of decorative objects in this folder as well. For this lesson we create a subdirectory named "'RedStones"'.
When the material and the 3D model are configured and all resources are located in the same folder, you can proceed directly to creating and configuring a decorative object type.
Right-click the folder with the resources and in the context menu select New -> Entity Type.
In the opened window specify the name of the new type — RedStones and its class — DecorativeObject. After that click Next.
To configure our type switch to the edit mode. To do this, right-click the RedStones.type file and select Edit in the context menu. Another way to switch to the edit mode is to double-click the file.
The main component of the decorative object type are 3D models, so let's start here. Select the "'Items"' option in the properties window and click "..." to the right of it.
In the opened window, click the Add button to add a 3D model.
In the right panel, select the 3D model, using the "..." button next to MeshName. Leave the Probability parameter (the likelihood of this model) intact.
The same way add the remaining four 3D models of the stones. Then press the OK button.
Now configure the remaining decorative object type settings. By analogy with DecorativeStones specify the following properties:
- BatchSize — the size of the group of generated objects,
- DistanceBetweenObjects — the minimum distance between objects,
- VisibilityDistance — the distance of visibility.
Read more about decorative object type parameters in this section.
Save the created type by clicking the Save button on the toolbar.
Our decorative object type is ready to use. Now, if you run the map editor and add the manager of decorative objects to the map, you should see our RedStones in the list of available types.
Place the red stones on the terrain.
This is the end of our tutorial.
In this tutorial we have learned how to create and configure decorative object types to use when creating maps.