How to implement Fog Of War with an shader?

Posted by Cambrano on Game Development See other posts from Game Development or by Cambrano
Published on 2014-08-23T22:35:57Z Indexed on 2014/08/24 4:34 UTC
Read the original article Hit count: 256

Filed under:
|
|
|

Okay, I'm creating a RTS game and want to implement an AgeOfEmpires-like Fog Of War(FOW). That means a tile(or pixel) can be:

  • 0% transparent (unexplored)
  • 50% transparent black (explored but not in viewrange)
  • 100% transparent(explored and in viewrange)

RTS means I'll have many explorers (NPCs, buildings, ...). Okay, so I have an 2d array of bytes byte[,] explored. The byte value correlates the transparency.

The question is, how do I pass this array to my shader? Well I think it is not possible to pass an entire array. So: what technique shall I use to let my shader know if a pixel/tile is visible or not?

© Game Development or respective owner

Related posts about unity

Related posts about shaders