Compositing a mist pass

As a bonus, we are going to learn how we can create and composite a mist pass with Cycles. But to do this, we will need to do a render. So let's do a render with 500 samples:

  1. We will first have to activate the mist pass in the Render Layer tab of the Properties editor. Now we can access the mist settings in the World setting panel. We will set Start to 0 m and Depth to 37 m.
  2. In order to see the mist, we will need to composite it over the render. We will learn more about compositing in further chapters, so don't worry if we don't go deep into the subject right now. In the Node Editor, we will have to switch to the Compositing Node mode (the second button after the material in the header). We will need to check Use Nodes and Backdrop in order to see our changes in real time. As you can see, we already have a RenderLayers node plug in the Composite node (the final output of the image).
  3. In between, we can add a Mix node (press Shift + A and select Color | Mix) and feed the first color input with the Image output of the RenderLayers node. The Fac input of the Mix node will receive a Map Value node (press Shift + A and select Vector | Map Value) with Offset of 0.105 and Size of 0.06. For the input of Map Value, we will simply plug our Mist pass (the fourth output of the RenderLayers node). The Map Value will control the amount of mist we see.
  4. In order to view the result in the Node Editor in real time, you will have to add a Viewer Node. To do this, we will simply press Ctrl + Shift and right-click on any node.
    Compositing a mist pass

    The final Cycles render of the Haunted House project

  5. We now have a nice mist! In order to change the aspect of the final render, we can tweak the Color Management options as we did in the previous chapter. Congratulations, you've completed the Haunted House project.