Book Image

Blender Cycles: Lighting and Rendering Cookbook - Second Edition

Book Image

Blender Cycles: Lighting and Rendering Cookbook - Second Edition

Overview of this book

Blender provides a broad spectrum of modeling, texturing, lighting, animation and video post-processing functionality in one package. It provides cross-platform interoperability, extensibility and a tightly integrated workflow. Blender is one of the most popular Open Source 3D graphics applications in the world. Modern GPUs (Graphics Processing Unit) have some limitations for rendering complex scenes. This is mainly because of limited memory, and interactivity issues when the same graphics card is also used for displaying and rendering frames. This is where Cycles rendering engine comes into play. Cycles is bundled as an add-on with Blender. Some of the features of Cycles is its quality, speed and having integrated industry standard libraries. This book will show you how to carry out your first steps in Cycles - a brand new rendering engine for Blender. In a gradual and logical way, you will learn how to create complex shaders and lighting setups to face any kind of situation that you may find in Computer Graphics. This book provides information on how to setup your first application in Cycles. You will start by adding lights, materials, and textures to your scene. When it's time for the final render, you will see how to setup Cycles in the best way. You will learn about a wide variety of materials, lighting, techniques, tips, and tricks to get the best out of Cycles. Further on in the book, you will get to know about animation and still shots, and learn how to create advanced materials for realistic rendering, as well cartoon style shaders. This cookbook contains a wide range of different scenes, proposed in a structured and progressive order. During this journey, you will get involved in the concepts behind every step you take in order to really master what you learn.
Table of Contents (18 chapters)
Blender Cycles: Lighting and Rendering Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Introduction
Index

Using the Cycles camera's depth of field


Creating images using a 3D program is often all about imitating reality. When we take a picture, something that often occurs is that some of the objects are out of focus. Such an effect is called depth of field (DOF) and is what we are going to recreate in this recipe.

Getting ready

Our first scene in Cycles is almost ready. However, we can still do a couple of things to make it look even more realistic. We will now see how to add a nice DOF effect.

How to do it...

To recreate the DOF effect in Cycles, let's follow these steps:

  1. Let's jump in now to our scene in Blender and select the camera. First of all we need to set the point in the scene where we want to keep the focus. To do this we need to select the camera and go to the Object Data menu (the one with the little camera icon).

  2. From here we need to activate the Limits option in the Display panel. In the viewport we will see that the camera now has a line going towards where it is looking and a yellow cross at the beginning. This cross represents the focus point.

  3. To set the focus point where we want it, we need to change the Distance value in the Depth of Field panel. We want the keyholder to be the focus point of the scene, so let's set the Distance value to 16. The yellow cross will now be placed over the key holder.

  4. For the DOF intensity, let's use Radius with a value of 0.0500. We do not want an effect that is too strong. For this particular scene we will simulate a round iris so that the default values are ok. Now we have a nice DOF effect in our scene that helps add realism to it. This is how the camera settings should look like if we did everything correctly in the following screenshot:

How it works...

With Blender Internal, the only way of adding this kind of effect is in compositing. Even if this method is still possible—also in Cycles—we now have another way of achieving the DOF effect.

Cycles has a DOF system built inside the camera. This means that now we dispose of a real ray-traced DOF effect which is much more accurate than the previous one. It is necessary to remind you that this new method also has some drawbacks. For instance, we will be dealing with render passes, and we will see that DOF generates a big amount of noise around edges, which can make it difficult sometimes to composite the scene. Another drawback is that once we render the image, we will not be able to change the DOF until we render the image again. This can be a problem especially for animations.

Anyway, apart from these two aspects the method of achieving DOF is fast and the final quality is really high.

There's more...

Another method of setting the focus point is to use an object. Right above the Distance value there is a field where you can put the name of the object on which you want to set the focus. The yellow cross will now automatically follow this object. It is important to remember that this doesn't mean that the camera will follow this object, just the distance of the focus.

On the left of where we set the distance value for the focus of the camera, there are the settings for the DOF. We can use two methods to set the intensity of the DOF: Radius and F/stop (focus stop). Bigger values for the radius will mean stronger DOF. On the contrary, with the focus stop method we need to lower the value to have a stronger DOF.

Right under the intensity value there are the iris settings, which will determine the shape and rotation of the bokeh effect. We can decide what shape and rotation the latter will have. If we want to have a circle iris it is enough to leave the Blade value to 0.