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

Creating a leather material for the wallet


Now let's see how we can create a material for a wallet. We want to recreate a smooth, worn eco leather.

Getting ready

First of all we need to add a new material to the wallet. Let's select the wallet mesh, add a new material to it, and name it Wallet.

How to do it…

To create the leather material, we will be following these steps:

  1. Now in the node editor add a Glossy BSDF node and mix it with the default Diffuse BSDF node using a Mix Shader node. Set the mix factor to 0.300 and the Glossy BSDF node's Roughness value to 0.100. Still not so great looking... is it? Let's make this material look a bit better! To do so we are going to use a combination of image textures and procedural textures.

  2. First of all let's add our Texture Coordinate node (Add | Input). Then we need to add a procedural texture. From the Texture section of the Add menu, click on Noise Texture. Link the Vector input to the Generated output of the Texture Coordinate node.

  3. For this material we just need to set the Distortion to 1.000, while for the other values the default settings of the Noise Texture node will be good for our needs, so we can leave them as they are. If you want to see how this texture looks, remember that you can use a Diffuse BSDF node.

  4. We will now be using a second procedural texture to recreate the smaller imperfections of the leather. It will again be a noise texture type. So let's duplicate the one we just created using Shift + D. In this one we need to set the scale to 100.000, while we will set Details and Distortion to 5.000.

  5. Now we need to mix the two procedural textures with a Mix node in mix mode, with a Fac of 0.050. We will be needing the black and white info of the textures, so we need to use the Fac output of the procedural textures, not the Color one. The Noise Texture node with the lower scale value (Scale 5.000) have to be plugged in the first socket, while the Noise Texture node with the higher scale vale (Scale 100.000) in the second socket.

  6. As we will see, this node setup will soon start to be a little bit crowded. It is a good thing to keep things organized, so let's name some nodes. Press the N key to bring out the properties panel. When you have a node selected in this panel, you will get some info and some settings about the node. With the last-created Mix node selected, write PROCEDURAL in the label space. Looking at the node, we can see that now it will not have Mix written on it anymore, but the name we just gave it. Note that you can also change other settings such as the name and the color of the node.

  7. Now let's add an Image Texture node and from the browser, select the scratches.jpeg image. This time as the texture coordinate we will use UV .

  8. To recreate the leather, we will be using another Image Texture node as well. Let's duplicate the previous Image Texture node and press the X button on the node to erase the path and load instead the image called stains.jpeg. Also for this texture we want to use UV coordinates.

  9. As we did for the procedural textures, let's mix these two Image Texture nodes. Plug them into a Mix node, scratches.jpeg in the second socket and stains.jpeg in the first one, Mix mode, Fac 0.20. As we also want to use the black and white information from the image textures, we need to convert them. To do this from the Convertor section of the Add menu, click on RGB to BW and link the Color output of the Image Texture nodes to the input of the node we just added. Let's label this Mix node Images.

  10. Now we want to mix the procedural texture and the image texture. To do this we will again use a Mix node. Plug the Mix node labeled Proc in the first socket and the one labeled Images in the second. For this particular situation we want to change the Mix mode to Add and set the Fac value to 1.000. Let's label the node GlossyCOLOR. Now let's plug the output of this Mix node to the Color input of the Glossy BSDF node. If we change the Diffuse BSDF node's color to a brownish color (RGB 0.150, 0.075, 0.030), we will see that now the wallet material starts to resemble leather, but the reflections are way too strong. To fix this, we need to darken the color of the Glossy BSDF node. Let's add a Gamma node between the GlossyCOLOR Mix node and the Glossy BSDF node and set the value to 1.750. The reflections now will be much weaker. Anyway, the material is still looking really flat and boring.

  11. To give some interesting variation to the surface, we will use the same color we are using for the Glossy BSDF node's color as a bump. Let's add a Bump node (Add | Vector), plug the GlossyCOLOR Mix node into the Height input, and the Vector input of both the Diffuse BSDF and the Glossy BSDF nodes into the Normal output of the Bump node. Now the surface is starting to be more interesting. All we need to do is set the strength to -0.030 .

  12. Let's give a final touch to this leather. We want to have more glossiness variation between the worn and the lesser worn parts of the wallet. Add another Diffuse BSDF node and set the color to RGB 0.500, 0.400, 0.250. This will be the color of the scratches and worn areas. Now let's add a Mix Shader node and plug in the second Shader socket BSDF output of the Diffuse BSDF node and in the first Shader socket plug in the mix between the other Diffuse BSDF and Glossy BSDF nodes BSDF outputs. This time we will not set manually the Fac value. Instead let's plug in it the output of the GlossyCOLOR Mix node. Finally plug the output of the Mix Shader node into the Material Output node and we are ready to go!

Here is how the final node setup will look like, in the following screenshot:

For the stitches it is enough to use a diffuse material with an RGB value of 0.650, 0.400, 0.250. We will name the material Stitches .

How it works...

In this leather material we can really start to see the power of nodes. First we created the map of the color by mixing different procedural and image textures. Then we used the very same node group, or part of them for the bump input and to mix two different BSDFs.

When we converted the two image textures to black and white color information, we were able to use it as a factor input for the last Mix node, telling Cycles how much we wanted of each one of the BSDF inputs. Precisely, black areas received influence from the first socket (the leather) and white areas from the second one (the material inside the scratches).

In this situation the scratches material was made using just a Diffuse BSDF node, but we could have created another big and really complex node setup if needed. As anticipated in the introduction, this kind of operation can be done in reality any number of times we want, making the possibilities virtually endless.

There's more...

A procedural texture is a computer-generated image that tries to resemble different natural patterns using functions, for instance, fractal noise and turbulence. These functions try in a different way to represent the "randomness" of nature. Procedural textures are set with different numerical values and can be seamlessly mapped over surfaces, even without the usage of UV maps.