Decal Grabber Plugin
Decal Grabber is a UnigineEditor plugin designed for automated optimization of the content at the large terrain distances. The plugin replaces the distant objects scattered across the terrain with a deferred orthographic decal that contains these objects baked into a texture. This enables to reduce the number of draw calls.
The Decal Grabber plugin splits the terrain into the specified number of tiles and then bakes each tile into a single texture. The number of the resulting textures corresponds to the number of the tiles.
Loading Plugin
To load the Decal Grabber plugin via UnigineEditor:
- Run UnigineEditor.
- On the Menu bar, click Plugins -> Manage.
- In the Plugins window that opens, set the Decal Grabber plugin enabled.
List of available plugins for UnigineEditor
- Close the Plugins window.
When the plugin is loaded, the additional Decals tab will appear for the ObjectTerrain node in the Nodes panel:
Grabbing Decals
To grab the decal, perform the following:
- Select the terrain in the Nodes panel and go to the Decals tab.
- Set the number of tiles per terrain side (the Tiles Per Side parameter) and the size of the resulting textures into which the tiles will be baked (the Tile Resolution parameter).
- Set the height above the terrain, at which the decal will be grabbed (the Grab Distance parameter).
In isometric view, objects have the same size regardless of distance from the camera (they cannot appear closer or farther). However, the Grab Distance parameter is required as it affects LODs switching (performed by the engine) and the other visibility settings.
The higher the distance, the fewer the number of objects and the fewer details of these objects will be visible on the grabbed decal.
- Set up parameters of visibility of the decal to be generated.
- Specify Padding and Anti-aliasing parameters to get smoother edges of the objects.
- Specify a path relative to the data folder where the generated textures for deferred orthographic decals will be stored.
- Press Grab.
In the result, the dummy node decal_lod will be added as the child node to the terrain. This dummy node will contain all the created decals. If you re-create decals, they will replace the existing ones in the nodes hierarchy.
The bounding box of each decal is calculated with respect to heights of the corresponding tile of the terrain.
Plugin Options
Tile Resolution | Size of the resulting texture into which a single tile will be baked. |
---|---|
Tiles Per Side | Number of tiles per terrain side. The size of the tile will be calculated relative to this value. |
Grab Distance | The height above the terrain, at which the decal will be grabbed. The higher the value, the fewer objects will be visible and the fewer details of the objects will be visible (depending on their LODs). |
Min Visible | A minimum visibility distance, starting at which the decal begins to fade in and then becomes completely visible, in units. |
Fade | A minimum fade-in distance, across which the decal smoothly becomes visible due to the alpha fading. It is counted starting from the minimum visibility distance value, in units. |
Max Visible | A maximum visibility distance, starting at which the decal begins to fade out until becomes completely invisible, in units. |
Fade | A maximum fade-out distance, across which the decal smoothly becomes invisible due to the alpha fading. It is counted starting from the maximum visibility distance value, in units. |
Decal Material | Material used for the decal. By default, the decal_deferred_base is set. |
Anti-aliasing | Scale factor that is used for smoothing objects baked into the decal texture. The initial size of the texture will be increased by this factor and then the texture will be downscaled to Tile Resolution. |
Padding | Edge padding in pixels. The specified number of additional pixels will be added in the region with the zero alpha. |
Path | Path (relative to the data folder) where the generated textures for decals will be stored. |
Grab | Grabs the decals and saves them into the textures. |