How is fog of war implemented in RTS games such as StarCraft II or Age of Empires? I'm making an RTS, and plan for every unit on the field to have circular vision up to a certain radius.
My first thought was having a mask that is black for every point except for points close to units, where it is transparent. The masking operation itself is fast in most graphics APIs (e.g. just call mix
in a shadercall mix
in a shader). The hard part is figuring out what mask to use and how to update it: updating it when any unit moves is very processor-heavy.
Is there any simpler way to manage this type of fog of war?