This tutorial was written by the amazing Jonatan Mercado and appeared in issue 108 of 3D Artist. Subscribe today and never miss an issue!
Blender has become a complete 3D software with infinite possibilities. With Blender you can create a full project from sketch to a stunning final render. Nevertheless, creating a good-looking render is not easy, even if you have every step done properly. You may have worked for hours modelling, spent a week unwrapping and texturing, walked outside to understand how light reacts to a rusted metal roof, and after all this work your render looks flat. That’s normal and we have all been there.
There is a vital component in a render that makes it jump from the screen and engage the viewer in spending a few extra seconds looking at the artwork, and that’s the mood you print on it.
Here I will share some useful techniques that I used in this project, which I started from a 2D painting by a great artist called Simon Stalenhag (simonstalenhag.se). I took a few artistic freedoms to convert the digital canvas into a photorealistic render, to create a morning mist. The mood of a render is usually driven by the details and those are always the main key to making your artwork jump from the screen. The effective morning fog is a great resource to add a dawn mood to any render.
Let me guide you in this tutorial on how to add realistic fog to your final render using the compositing nodes in Blender with two procedural images.
Step 01 – Mist data pass
The Mist pass in Blender refers to the distance to visible surfaces, mapped to the 0.0 to 1.0 range. You have to enable this pass in the Scene tab, and the settings can be found in the World tab where you will be able to control the coverage range of this pass. You can enable the Mist box in the Camera tab under the Display label to actually see the coverage range in the 3D viewport. This will be shown as a yellow line perpendicular to the camera. This pass can be used at the compositing stage to add fade-out objects that are further away.
Step 02 – Depth controlling
Once you have the render done, you will see the Mist pass in your Render Layer. Connecting a Color Ramp to the Mist Pass output will let you control the depth of the mask. The default number of stops for the Color Ramp node to control where the fog will start to be noticeable is two, and for our purpose, that will be enough.
It’s important to use the Ease mode as the interpolation between the stops in order to have a smooth transition between them. The fog ideally needs to subtly appear beneath the focal element and then become more dense in the background of the scene.
Step 03 – Texture creation – height
The Mist pass isn’t enough when you are looking for a realistic-looking fog. The default mist in Blender is plain and doesn’t look like real, volumetric and interesting fog. That’s why you will need two complementary textures to add some visible interest. You can create it in Blender or use another software. In my case, I decided to use Gimp, but any graphic software will do. The first texture will control the height of the Mist pass. It’s a simple lineal gradient from black to white. The second texture will be a noise greyscale pattern to add turbulence to the fog.
Step 04 – Texture creation – turbulence
You have the Mist pass in the Render Layer to control the depth of the fog, so now you have to connect a lineal gradient to control the height of the fog. Then you will have a volume controller. In Gimp you need to create a light-grey layer (#dedede). Then go to the Filters menu>Render>Clouds>Fog. The fog layer menu will appear. You need to change the colour from the default white to a slightly darker grey than the original
layer (#8f8f8f). Once you press OK you will have a nice greyscale mask.
Step 05 – Height controller
Back in Blender you have to open the Height Controller inside the compositing nodes as an Image and use a Color Ramp to control the height of the fog. Again, setting the Interpolation mode as Ease will make the transition between the two stops of the Color Ramp smoother. In real life, as soon as the fog gains altitude it starts to vanish, so use this controller to decide when it is going to start disappearing. For that you can create more than one handle and generate a dense amount of white near the floor, and then create a smooth transition to the highest part of the render, which in this case is the sky. Just play with it and have fun finding the right spot for you.
Step 06 – Turbulence control
Now you have to open the Turbulence Control in the Blender Compositor as an Image. The way I control the smoothness of the turbulence is by adjusting the contrast slightly, and for that I use the RGB node. I usually add a Color Ramp to give depth to the turbulence. Thanks to the node wrangler, you can press Ctrl+Shift+Left Click on any node and view what impact that particular node is having over the final render. You must use this way to work with the RGB node and Colour Ramp in order to understand what kind of effect you are creating.
Step 07 – Fog blending
This is a fundamental point when compositing. You need to mix the Height Controller and Turbulence Control together into a smooth transition. You need a Color Mix node; use the turbulence as the Factor, connect the height in the second slot and set the colour of the first slot to a dark grey (#232323). What you are going to get here is basically a mask for the next step.
To understand how the Mix nodes work in Blender you have to understand the power of the Factor slot. If you don’t connect anything to the Factor, you will have a slider that will let you decide which percentage of the first slot will be mixed with the second slot. But if you connect an image to that slot, you will have total control over the blending mode. Understanding that 0 is black and 1 is white, the Factor will react to a greyscale image connected to it. So if it finds black in the pixel, it will give as a result the first slot of the mix, but if it finds white, it will give as a result the second slot of the mix. With our mask we created a greyscale texture full of detail and complete with 50 or more grey shades.
Step 08 – Fog colour
With our mask created we have to mix it with our original render, and in order to do that we are going to use another Color Mix node. The general idea is to use the mask to tell Blender in which pixel it needs to show the render and in which pixel it needs to mix the render and our cool fog. We are going to connect the output of the colour mix we created before with the Factor of our new colour mix. We are going to connect the Render Layer to the first slot of this new node. As the mask we created is not a uniform colour and the fog has turbulence thanks to our previous steps, we will have a very cool variation in the volume of our fog. You can decide the best colour for the second slot to fit your scene.