Fog of War for games

Not too long ago, I ran into a challenge of implementing Fog of War system for my game, so I wrote an article on how to implement it in Three.js


Hopefully some of you might find this useful. Questions and comments are welcome.

15 Likes

Good article! :+1:

1 Like

OMG, Chess with Fog-of-War! That would be an amazing game, where you can only see squares that your pieces can move to. :exploding_head:

3 Likes

Haha, that’s kind of what my game is :thinking:

…that is, if chess pieces had talent trees and could level up. Yup, pretty much the same as chess! :wink:

1 Like
5 Likes

Great article! Thanks, it solved my problem. But I’ve got 1 question. How did you do it such smooth? When I tried implement it in my game, I’ve got this:
image

Ofc it’s not bad, but if you know how can I get smoother effect I will be grateful for any suggestion.

That’s quite easy. A box blur. I have a custom shader to draw the fog mask, in it I sample 9 pixels instead of 1. So you get a nice smooth gradient.