Adding fog with FogFilter
The fog filter allows you to create the illusion of objects disappearing gradually in a fog when the distance between the objects and the camera increases. This is a common effect in 3D games, preventing objects from suddenly disappearing behind the far plane, usually somewhere on the horizon. The filter generates a number of viewport layers with alpha transparency distributed over a region that you specify. The transparency of the layers is based on the number of layers you define.
Instantiating the filter is easy:
renderer.filter = new FogFilter(new FogMaterial(0xFFFFFF), 16,800,2000);
It takes the following parameters:
|
Parameter |
Data type |
Default value |
Description | |
|---|---|---|---|---|
|
1 |
|
|
|
The fog material. The |
|
2 |
|
|
|
Sets the number of layers. The higher this value, the lower the alpha value of the layers will be... |