Fog
Fog can be used in 3D games to make objects in the distance look blurred or even disappear. This helps in creating atmosphere and it makes it possible to not draw objects that are far away. To enable or disable fog use the following function:
d3d_set_fog(enable,color,start,end) Enables or disables the use of fog. color indicates the fog color. start indicates the distance at which fog must start. end indicates the distance at which fog is maximal and nothing can be seen anymore.
To better understand what is happening, there are actually two types of fog, table based fog and vertex based fog. The first type calculates fog values on a pixel basis. The second type calculates the fog value for each vertex and then interpolates these. The first type is better but not always supported. Game Maker tries to use table based fog when supported and otherwise uses vertex based fog (unless no fog is supported). Note that certain graphics card indicate that they can handle table based fog but offer the user the possibility to switch this off in the advanced display settings. In this case the result might be a black screen!