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 Glossy shader to create a clean metal material


Now that the lighting is ready, we need to add some material to the objects of our scene. Let's start with the key.

Getting ready

Select the key from the scene, add a new material and name it Key. Even if the key material alone will be quite simple, this time we are going to use the node editor in order to set it up.

By default when we add a new material, Cycles will add a Diffuse shader node and of course, the material output. For the key metal we will also need this node, so let's leave it where it is. Moreover, we are going to need a glossy shader in order to add reflections to the key surface.

How to do it...

These are the steps to create the materials of this recipe:

  1. To add a new node, we need to keep the cursor on the node editor and press Shift + A to make the Add menu appear. Now let's go to Shader | Glossy BSDF. A new Shader node will appear where your cursor stands.

  2. Now we need to mix the Diffuse BSDF and the Glossy BSDF nodes. To do this, we can use the Mix Shader node. You will find it again in the Add menu, Shader section. Now let's take the output from the Diffuse BSDF node and plug it into the first Shader input of the Mix Shader node, and the output of the Glossy BSDF node into the second Shader input of the Mix Shader node. As a last thing, take the output of the Mix Shader node and plug it into the Surface input of the Material Output node.

  3. In the real-time viewport you should already see that the key is looking much better than with the plain white material it had before. Anyway, we need to make a couple of tweaks to make it look as it really should.

  4. First of all we need to change the mix factor in the Mix Shader node. Let's change the face value to 0.800. In this way 80 percent of the output will come from the lower shader input, where we connected the Glossy BSDF node. Now the key should have stronger reflections on the surface.

  5. Anyway if we observe a real key, we will notice that reflections are quite sharp when objects are close to the surface, while they get a bit blurred as the distance increases. Our key right now has definitely too blurred reflections, and to make them sharper, we need to change the Roughness value of the Glossy BSDF node. Set it to 0.060 and now we can see that the reflection of the close objects are much sharper.

  6. The last thing to do is to change the diffuse color to a gray one (set RGB values as 0.200, 0.200, 0.200).

The final node setup should look like the following screenshot:

And that's it! We just created our first Cycles material!

How it works...

In this first material we are mixing two different BSDFs to obtain the desired result. While the Glossy BSDF is important to get reflections on the surface of the key, it is also true that the metal of which the key is made of does not behave as a mirror. This means that even if it is strongly influenced by the colors and lights around it, in most cases it will maintain its grayish color. This is why we mixed the Glossy BSDF with a bit of Diffuse BSDF. The Diffuse BSDF is useful to give a plain color to a surface. It will still be influenced by surrounding objects and lights, but it will help the surface to maintain its gray color in most environment situations.

There's more...

You will see the BSDF acronym next to every shader node in Cycles. Applying a shader to a material will change the way in which the lights interact with the surface of that material. Each different shader node contains a different BSDF.