When I was working on the “super move effect” for Killer Dolls Battle Arena (an effect you can see in my article about exporting iClone camera animations to UE4), I realized I needed to make a fog effect for it. While Unreal Engine includes a fog effect, it’s a more regular effect based on altitude, distance, etc., that you can use to create atmospheric fog, and I needed a simple “fog wall” that I could turn on and off.
At the end, I decided to create my own “fog material” that would be based on the depth, and that would simulate depth fog even if it’s just a material applied on a regular plane.
Creating the material is fairly easy. First, create a new material and use these parameters.
And then, simply create this setup.
The result is what you see in the image below. As you can see, it looks like a block of green fog, and objects gradually fade from the fog plane until nothing is visible.
You can control the distance at which everything is completely covered in fog. For example, the original image had a FadeDistance of 500, but if I change it to 1500, you get the following result (please note I did not move the plane; I just changed the parameter).
Another thing you can do is change the overall density of the fog. This is important if you don’t want “Silent Hill-style fog” that covers everything, but rather a lighter fog that still lets you see everything in the back. The image below uses a FadeDistance of 1000 and an Opacity of 0.85.
Since it’s a material, you can also use a texture to add some “texture” to your fog.
To do this, just add your texture and multiply it by the fog color. You can also just use the texture, but I use the multiply so I can control the color of the fog.
You can use this for other things too, though. For example, you can attach a fog plane to your third person camera, and use this as an alternative to create regular Unreal Engine fog. This image shows the fog plane attached to the Amelia’s camera in Just Let Me Go. By doing this, the fog will always be visible and will follow the player’s camera.
And this is how the fog looks in the game.
Of course, this depth material node can be used for other things. Off the top of my head, I think depth-based distortion effects, or depth-based color effects could be really cool. I will explore this node more and think of other ways to use it.