- Blender Cycles:Lighting and Rendering Cookbook
- Bernardo Iraci
- 590字
- 2021-07-19 18:48:17
Creating a rubber shader for the key holder
Now we will create a material for the key holder. It will be a soft rubber material and something completely different from the metal of the key.
Getting ready
Before we start to create the material we need to add it to the mesh. Let's select the key holder mesh, add a new material to it, and name it KeyHolder
.
How to do it...
These are the steps we are going to take to create the rubber material:
- Now, erase the Diffuse BSDF node from the node editor as we will not use it. Instead, we will be using the combination of Translucent BSDF and Glass BDSF nodes. Add them from the Shader section of the Add menu. Also add a Mix Shader node and link the Translucent BSDF node to the first Shader input and the Glossy BSDF one to the second Shader input of the Mix Shader node. Also set the Fac value to
0.100
. - As you can see in the viewport, the key holder now has a white milky material, with the light scattering inside itself. Anyway, to give it a rubber-like look we need to tweak the Glass BSDF node a bit.
- Let's change the Roughness value of Glass BSDF to
0.500
. Doing so, we will make both the refractions and the reflections generated by this BSDF quite blurry, to resemble the look of a piece of rubber. Also set the Glass BSDF color to pure white. - The last thing we need to do is to set the correct IOR value for the rubber. On the Internet you can easily find information about the IOR (Index of Refraction) of different materials. Rubber for instance has an IOR of 1.5191. Let's set the IOR value in Glass BSDF to
1.5191
.
Here is how the final node setup will look like in the following screenshot:
How it works...
A rubber material needs the light to be scattered inside itself. Moreover, it will have a slight amount of reflection on its surface and refractions within its volume.
With the Translucent BSDF node we make the light scatter through the key holder. As we need a touch of reflections and refractions, we will use a small amount of the Glass BSDF node. As both reflections and refractions are quite blurry for a piece of rubber, we increased the roughness value of the Glass BSDF node.
The color of the Glass BSDF node is really important. As we will see, especially in the next chapter, really small changes make a big difference. In order to not make a glass look dark and almost dirty the color needs to be pure white. Even a slightly darker color will not make the glass look good.
There's more...
The Translucent BSDF allows the light to pass through the object and get scattered within. The surface, as in the Diffuse BSDF, is without reflections. On the other hand, a Glass BSDF, as the name tells us, is a shader used to recreate glass materials. While for the Translucent BSDF we can just choose the color, and for the glass we can change the glossiness of the refractions and the IOR. This last value represents the ratio between the speed at which the light travels in vacuum compared to the speed in the object. This is the reason why when we look through a piece of glass we see things distorted. Moreover, the Glass shader generates not only refractions, but also reflections on the surface of the object.