This function can be used to enable or disable fog drawing. Fog can be used in 3D games to make instances in the distance look blurred or even disappear, which helps in creating atmosphere as well as masking the fact that you are not drawing instances that are far away. You set whether it is enabled (true) or disabled (false), the colour that the fog should use for blending, as well as the start and end draw distances. Note that the fog start indicates the radius relative to the view camera where the fog starts, and the fog end indicates at which radius (also relative) instances will be completely invisible.

The function can take four individual arguments (given above) or an array with the following structure (the example code below shows this method):


gpu_set_fog(enable, colour, start, end);


Argument Description
enable Enable or disable fog
colour The fog colour
start The distance to start applying fog from
end The distance to end the fog




var fog_a = gpu_get_fog();
fog_a[1] = c_red;

The above code gets the current fog settings and then sets the colour element of the array to c_red before setting the fog again using the changed array.

Back: GPU Functions
Next: gpu_set_cullmode
© Copyright YoYo Games Ltd. 2018 All Rights Reserved