Making Environment Look Realistic with Randomizer Plugin
Randomizer is an UnigineEditor plugin designed for making environment look more natural.
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.
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:
Nodes Replacing
To replace nodes with other nodes taken randomly from the specified set, you need to do the following:
- Select the nodes that will be replaced in UnigineEditor.
- In the Reference field of Randomizer choose the .node file (the selected node will be replaced by this node).
- Specify the probability of the node occurrence in the Probability field.
- If required, add other references.
- 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:
- 12/20 for white cars
- 6/20 for blue cars
- 1/20 for green cars
- 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:
- 6/20 for white cars
- 6/20 for blue cars
- 1/20 for green cars
- 1/20 for red cars
- 2/20 for brown pickups
- 1/20 for blue pickups
- 1/20 for purple trucks
- 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:
- Select the nodes that will be rotated in UnigineEditor.
- Select the rotation angle limits in the X Variation, Y Variation and Z Variation fields.
- 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: