Setting up minimap
Atavism 2019.1 comes with the minimap feature, which is based on the UGUI minimap solution. You can use it with two basic options, first as real-time rendering camera, and the second option is to prepare texture to reduce the impact on the performance.
The easiest way to use minimap is to open BlankAtavismSecne, and drag all elements like Canvas, MiniMap, MainCamera, EventSystem, and WorldBoundary to your target scene. Objects related to the minimap are Canvas, where minimap will be drawn, MiniMap game object where you can set multiple parameters and adjust it to your needs, and WorldBoundary, which is responsible for instantiating plane with minimap texture (from the additional camera in realtime or from the prepared texture).
It’ s also important to add MiniMap layer in Atavism Editor in Layer 9.
Atavism minimap component which presents quests, resource nodes, and mobs is automatically added in runtime to Ataivsm entities when they are within the players quad.
While real-time minimap is just a tick the checkbox in the MiniMap game object in the scene, preparing texture which will replace the real-time rendering requires a few additional steps.
In the MainWorld scene (with demo data) you will find an additional game object called MiniMapScreenshot, where an additional camera is attached and BL_Snap Shot component. You can set resolution there, but the most important is that the camera would be adjusted to the center of your map, with the proper size, Y value, and rotation in the X-axis by 90 degrees. Size should be corresponding to the half or your WorldBounday Width x Height. After this setup taking a screenshot is simple as clicking on the button “Take Snap Shot” on the MiniMapScreenshot game object.
How to configure your snapshot camera, how to make a snapshot and use it for your minimap.
For this part, we will use MainWorld example scene.
- Open your MainWorld scene.
- Find SnapshotCamera prefab (Assets/Dragonsan/UGUIMiniMap for Atavism/Content/Prefabs/Util/SnapshotCamera.prefab) and drag it to the scene hierarchy.
- Switch your editor so you could see your map from the top perspective. Click Y green axis marker in the scene view, and then Perspective view like on the screen below.
You should have a similar view as below.
- Now select your SnapshotCamera and adjust its values. Important is Size which should be with the half size of your map width/height (whichever is larger in your case). In our case width and height is basically the width and height of the terrain (512×512), so our SnapshotCamera size we will set to 256. You can also adjust your Res Width and Res Height to increase the resolution of the snapshot (up to 8192×8192).It’s also important that your SnapshotCamera game object should be on the height above the highest map object, to render all elements (Y position in the Transform), and the Far parameter is set to render all objects within its distance.
- You are ready to take the snapshot but there are also a few optional tips you may want to use. You can increase your LOD level, as some objects from such distance might be cullied, in order to do this, just open your Project Settings -> Quality, and set Lod Bias to some really high value like 10 000.
Before Lod Bias adjustments
As you can see there are trees and other objects which were culled before.
Nest tip is to make your screenshot in the runtime, so you could have nicely rendered map including post processes.
In the end, we just need to click Take Snapshot on our SnapshotCamera object in our scene.
And we should see that the snapshot was taken successfully in the Unity console
- Screenshots are saved in the Assets/Dragonsan/UGUIMiniMap for Atavism/Art/SnapShots directory, so you can drag it from there and attach it to the MiniMap game object general settings
- Disable or remove SnapshotCamera game object in your scene, and revert back Lod Bias from 10 000 to your value, probably 2.