This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
High-Level Systems
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
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Making Environment Look Realistic with Randomizer Plugin

Randomizer is an UnigineEditor plugin designed for making environment look more natural.

City Import Plugin

Cars and Trees Modified by Randomizer Plugin

Randomizer Plugin can perform the following operations with nodes selected in the Nodes panel of UnigineEditor:

  • Replace selected nodes with other nodes taken randomly from the specified set in accordance with the normal law of distribution.
  • Rotate selected nodes randomly within the angle limit in accordance with the normal law of distribution.
Notice
You can perform both operations together. Besides, you can perform the randomization as many times as you want: every time you will get the different result.

Plugin Loading

To load the Randomizer plugin, open the Tools -> Plugins tab in the UnigineEditor, press the Core button and choose the tools/randomizer.cpp. The plugin window will open:

Randomizer Interface

The Randomizer Plugin Interface

Nodes Replacing

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

  1. Select the nodes that will be replaced in UnigineEditor.
  2. In the Reference field of Randomizer choose the .node file (the selected node will be replaced by this node).
  3. Specify the probability of the node occurrence in the Probability field.
  4. If required, add other references.
  5. Press the Randomize button.

The randomization will be performed in accordance with the normal law of distribution.

Usage Example

For example, we have a set of fully identical white cars at the parking lot:

To diversify the cars color range, we need to do the following:

  • Select all the cars in the scene.
  • Add references for the differently colored cars in Randomizer: white, blue, green and red.
  • Select the probabilities of each car type occurrence: 12 for white cars, 6 for blue cars, 1 for green cars and 1 for red cars.

According to our set probabilities, the frequency of cars of each type occurrence will be the following:

  1. 12/20 for white cars
  2. 6/20 for blue cars
  3. 1/20 for green cars
  4. 1/20 for red cars

After pressing the Randomize button we will get the following result:

In the second case we will replace cars not just with cars of different colors, but with different types of vehicles: brown and blue pickups; purple and orange tracks.

According to set probabilities, the frequency of cars of each type occurrence will be the following:

  1. 6/20 for white cars
  2. 6/20 for blue cars
  3. 1/20 for green cars
  4. 1/20 for red cars
  5. 2/20 for brown pickups
  6. 1/20 for blue pickups
  7. 1/20 for purple trucks
  8. 1/20 for orange tracks

The result is the following:

Nodes Rotating

To rotate selected nodes randomly within the angle limit, you need to do the following:

  1. Select the nodes that will be rotated in UnigineEditor.
  2. Select the rotation angle limits in the X Variation, Y Variation and Z Variation fields.
  3. Press the Randomize button.

The randomization will be performed in accordance with the normal law of distribution.

Usage Example

As an example for rotation randomization, lets set the 180 degree value for the Variation Z parameter of the nodes present in the previous scene:

Setting the value of 180 degree means that there is no limit for object rotation and it could have any random direction. If, for example, we would set the value of 45 degrees, the direction of the objects will be chosen randomly within 90 degrees (an angle is laid off on either side).

The result is the following:

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