Using the Dynamic Fog of War prefab
Dynamic Fog also includes a custom prefab optimized for Fog of War usage:
This prefab does not use any image effect but a custom shader that works much faster on mobile.
Please check demo scene 7 for a full example.
To use this feature in your game, just locate and drag the prefab FogOfWarLayer located in DynamicFog/Resources/Prefabs folder to your scene. Position the plane over the terrain or area to cover. Then, the following API is available:
DynamicFogOfWar fog = DynamicFogOfWar.instance;
Set Fog of War Terrain Boundary:
fog.SetFogWarTerrainBoundary(terrain, borderSize)
This function smoothly cuts the fog crossing the terrain. This call is optional and only useful if you want to produce a smooth cut like in the image above.
Set Fog of War Alpha:
fog.SetFogOfWarAlpha(worldPosition, radius, alpha)
Call this function to clear or set a custom fog transparency on any world position.
Reset Fog of War:
fog.ResetFogOfWar();
Call this function to restore fog of war to fully opaque.
Set Fog of War Texture Size:
fog.fogOfWarTextureSize
This property determines the resolution of the internal alpha control texture.