This page has been translated automatically.
Программирование
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Adding Variations for a More Realistic Environment

Randomizer is a UnigineEditor tool designed for adding variations of the scene objects in few clicks.

Randomizer Interface

Randomizer Tool

Notice
To open the Randomizer tool, choose Tools -> Randomizer in the Menu Bar.

The Randomizer can perform the following operations with nodes:

  • Replace the selected nodes with other nodes taken randomly from the specified set according to the normal law of distribution.
  • Change position, rotation, and scale of the selected nodes randomly within the range according to the normal law of distribution.
Notice
You can perform all operations together. Besides, you can perform the randomization as many times as you want: every time you will get the different result.

Randomizer Settings

The Randomizer tool provides the following settings:

Offset Offset of the selected nodes taken randomly from the specified range. An offset range is specified for each axis.
  • From specifies the minimum offset of nodes in units.
  • To specifies the maximum offset of nodes in units.
You can specify both negative and positive values.
Rotation Rotation of the selected nodes by the angle taken randomly from the specified range. Rotation is performed relative to the current direction of an axis. An angle range is specified for each axis.
  • From specifies the minimum angle by which nodes can be rotated.
  • To specifies the maximum angle by which nodes can be rotated.
If one of the values is negative, the nodes will be rotated about the axis in both directions (clockwise and counterclockwise).
Scale Scale of the selected nodes taken randomly from the specified range. A scale coefficient is specified for each axis.
Notice
If you enable the Uniform Scale option, you can specify the coefficient only once: the nodes will be scaled along all axes.
  • From specifies the minimum scale coefficient for nodes.
  • To specifies the maximum scale coefficient for nodes.
To downscale the selected nodes, specify values in range [0;1).
Place Nodes as NodeReference Toggles adding the specified nodes as NodeReferences to the scene on and off. If the option is disabled, the replaced nodes will change its types to the types of the replacing nodes stored in the .node files.
Nodes Set of nodes (.node) or/and meshes (.mesh) that will be used for random replacing of the selected nodes. To add a new node/mesh, click or drag a file from the Asset Browser. The following fields will appear:

  • File Name field displays the name of the replacing file.
  • Probability field allows specifying the probability of node/mesh occurrence. According to this value, the frequency of node/mesh occurrence is calculated as follows: the probability value of each node is divided by the sum of probabilities set for all nodes/meshes in the set.

Replacing Nodes

To replace nodes with other nodes taken randomly from the specified set, you need to do the following:

  1. Select the nodes that should be replaced.
  2. Add nodes that will be used for random replacing of the selected nodes in one of the following ways:
    • In the Nodes section, press , then click in the field that appears and choose a .node or .mesh file in the dialog window that opens.
      Notice
      You can specify a .node file stored inside the asset container.
    • Select the required nodes in the Asset Browser and drag them to the Nodes section.
      Notice
      You can also drag an .fbx, .dae, .obj or .3ds file: a .node file stored inside the asset container will be specified automatically.
  3. Specify the probability of the node occurrence in the field to the right.
  4. Toggle the Place Nodes as NodeReference option on, if required.
  5. Press the Replace button.
The randomization will be performed according to the normal law of distribution.

Usage Example

For example, we have several identical barrels:

To diversify the types of barrels, we need to perform as follows:

  1. Select all barrels in the scene.

  2. Add the .node files with different types of barrels to the Nodes section by dragging them from the Asset Browser.

  3. Specify the probabilities of occurrence of each type of barrels:
    • 10 for red barrels
    • 5 for blue barrels
    • 2 for light brown barrels
    • 1 for brown barrels

    According to our set probabilities, the frequency of occurrence of barrels of each type will be the following:
    • 10/18 for red barrels
    • 5/18 for blue barrels
    • 2/18 for light brown barrels
    • 1/18 for brown barrels
  4. Toggle the Place Nodes as NodeReferences option on, so that the specified nodes are added to the scene as NodeReferences. It may be useful if you will decide to change barrels of a certain type later. In this case, you will need to edit only one barrel: the others will be updated as well.
  5. Press the Replace button. The selected nodes will be replaced with the node references from the list.

Transforming Nodes

To translate, rotate or scale the selected nodes randomly within the specified range, you need to do the following:

  1. Select the nodes that should be transformed.
  2. Specify ranges for the Offset, Rotation and Scale values.

  3. Press the Replace button.

The randomization will be performed according to the normal law of distribution.

Usage Example

  1. Select all barrels in the scene.

  2. Specify ranges for the transformation parameters:
    • [30;180] degree for rotation about the Z axis.
    • [0;30] for offset along the X and Y axes.
    • [1;3] for scale by the X, Y, and Z axes.

  3. Press the Replace button. The selected nodes will be transformed according to the specified values.

Last update: 21.12.2017
Build: ()