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):
- [0] = enabled toggle (a boolean, either true or false), default false
- [1] = colour (real), default c_black
- [2] = start distance (real), default 0
- [3] = end distance (real), default 1
gpu_set_fog(enable, colour, start, end);
参数 描述 enable Enable or disable fog colour The fog colour start The distance to start applying fog from end The distance to end the fog
N/A(无返回值)
var fog_a = gpu_get_fog();
fog_a[1] = c_red;
gpu_set_fog(fog_a);
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.