skip to Main Content

Fog of War

Fog of war is a mini-map feature useful to hide unexplored areas to the player. Since the mini-map can show distant areas, you can use the Mini-Map volumes to control what can be visible on the mini-map.

In the screenshot below you can see a blue box (fog of war) hiding an area.

To enable the Fog of War feature just enable it under the Mini-Map section below:

Parameters:

  • Center and Size: represents the area of the world where the fog of war feature can be shown.

  • Resolution: texture resolution for the fog of war effect.

  • Fog Color: optional tint color for the fog.

  • Layer: the fog of war layer is rendered as a big quad under the zenithal mini-map camera. In order to avoid it showing up in the main camera, make sure the Layer is culled from the Main Camera. You can also click “Exclude From Main Camera” to automatically exclude the layer of the fog of war object from the main camera culling mask.

How to add fog volumes:

You can add any number of fog areas to the scene by using the option:

It creates an empty gameobject with a Box Collider so you can resize it to match the desired area and a Compass Pro Fog Volume script attached with properties to customize the fog area appearance:

Use the transform position and scale to define the location and size of the fog area. And customize the fog area appearance using the script properties:

  • Alpha: transparency of the fog (1=fully opaque fog).

  • Border: width of the border for the fog of war volume.

  • Order: fog volumes are rendered in the order defined by this property.

Changing the transform position or scale will trigger a fog of war update which can be expensive if you have many fog areas.

Another way to modify the fog of war at some position is to call the SetFogOfWarAlpha methods (please jump to API section for a full list of fog of war methods and examples on how to call Compass Pro methods).

Back To Top