Fog Planes in 20 Steps or Less

About Fog Planes

Now, you too can enjoy fog planes without expensive fog makers or messy buckets of dry ice. The images above show the following:

1) A scene with standard A6 fog
2) Fog planes added along ground level
3) Lighting added to accentuate the effect
4) Another scene with a thin series of fog planes

This is a pretty simple effect you can achieve by creating a series of semi-transparent discs that follow the player around.

Tutorial

1) Grab the disk model. This MDL is just a flat, wide disk.

2) Add the Fog Plane Generator entity to your script:

# Generate a series of fog planes
action entity_fog_plane_generator {
     var fog_zpos;

     # Generate 5 fog planes:
     fog_zpos=0;
     while(fog_zpos<5) {
         ent_create("disc2.mdl", vector(my.x, my.y, my.z+fog_zpos*8), entity_fog_plane);
          fog_zpos+=1;
     }

     # Now go away:
     ent_remove(my);
}


This creates 5 copies of disc2.mdl, each spaced a 8 quants apart. They'll use the entity_fog_plane action from the next step.

3) Add the Fog Plane to your script:

# A fog plane that follows the player around:
action entity_fog_plane {

     # Allow entities to pass through the fog:
     my.passable=1;

     # Self-illuminate:
     my.light=1;
     my.red=255;
     my.green=255;
     my.blue=255;

     # Make us semi-transparent:
     my.transparent=1;
     my.alpha=10;

     # Follow player's x and y coordinates but keep z the same:
     while(1) {
          if(player) {
               my.x=player.x;
               my.y=player.y;
          }
          wait(1);
     }
}


4) Add the Fog Plane Generator to your level. In your level (from within WED,) load in a model and attach the entity_fog_plane action to it. Note that the model you use for this does not have to be a disk; it's just the generator that creates the disks.


Additional

Also try changing:
  • The entity_fog_plane's .red, .blue, and .green for different colored fog planes.
  • In entity_fog_plane_generator, increase the terminal value of while(fog_zpos<5) for more layers of fog.
  • In entity_fog_plane_generator, change fog_zpos*8 to fog_zpos*1 for denser fog, or to fog_zpos*16 for sparser fog.

Copyright ©2003 by Dejobaan Games