I am developing an RTS game that needs fog of war. The game will have at most 200 units that can be seen through the main camera. So, how can we achieve fog of war?
There a many ways, but a popualr one is using a plane laid over the terrain with a black texture, and then letting units raycast against it upwards, thereby getting the nearest vertex from the raycast hit, and then changing the alpha value of the pixels of the texture around that vertex to zero.
Here is one way to do this: