Best way to implement Fog of War?

What do you think is the best way to implement Fog of War?

  • Have Directional Lights suspended above units
  • Recolor the terrain using the NodePath.getDistance() method
  • Other

0 voters

How do you think I should implement Fog of War in my RTS?

If you selected Other, please specify below! Thanks in advance!

I’d do it as a big, projected texture from top, using a texture stage with MModulate setting and a high sort value. One pixel on the texture represents one grid unit.

You can then use PNMPainter to paint a circle around the player’s position, on this texture image.

Do you have an example of anything PNM related handy? I’ve never used any of those classes.

This sample program uses PNM classes too:
discourse.panda3d.org/viewtopic.php?t=6002

OK, I think I kinda understand it, but how would I draw a circle?

Use PNMBrush.makeSpot with a bigger radius.

These pages are helpful:
panda3d.org/apiref.php?page=PNMBrush
panda3d.org/apiref.php?page=PNMPainter
panda3d.org/apiref.php?page=PNMImage

Oh, OK thanks, didn’t notice I could change the radius.

I’d also apply this in a shader over everything in the game world.

If you have performance problems PNM stuff i also can suggest using an offscreen buffer and draw cirlces there using standard padna3d api.

Thanks, treeform, I’ll keep that in mind, though I’m not very good with shaders…

How would you approach situation when you visit some area fog of war is removed from that place permanently?

Situation I deal with is even simpler because map consists of small cubes placed on the same level viewed from isometric camera.

Similar to one presented here (Dungeon Keeper) youtube.com/watch?v=3hGlq2WA2_U.