Fog dissolve effect

As nicely demonstrated by the game Battlefield 4, when you walk near a ‘smoke’ or ‘fog’ alpha plane, it fades out until you have moved away from it.

This works well because you don’t have the player focusing on the bad edges of the fog/smoke or the seemingly obvious effect of it tracking to the camera.

What would be the most efficient way to go about this?

  1. on each ‘smoke’ plane add a near sensor joint to a fade out animation with a nand controller for a fade in animation when the player walks away from the smoke.

  2. on each ‘smoke’ plane add a python controller and run a script that calculates the distance between the plane and the player and reduces the objects alpha if the player gets too close.

  3. ?? Is there any other way of achieving this effect?

**using lamp nodes leaves a big hole in the planes texture so that doesn’t really work


import bge
if 'player' not in own:

untested and needs work

Yeah nodes are really flexible for this kind of thing - you can make thing disappear if you are near (of far), you can even make mist without using the world mist option.