Creating an organic-looking shader with procedurals
In this recipe, we will create a sort of organic, disgusting-looking material, as shown in the following screenshot:
The disgusting organic material as it appears in the final rendering
Getting ready
Start Blender and open the 9931OS_08_start.blend file, where there is an already set scene with an unwrapped Suzanne primitive object leaning on a Plane, an Emitter mesh-light, and a Camera.
Go to the Render window, and in the Sampling subpanel, change Pattern from Sobol to Correlated Multi-Jitter.
How to do it...
Let's go straight to the material creation by using the following steps:
Click on the New button in the Node Editor window toolbar or in the Material window under the main Properties panel and rename the new material Organic.
In the Material window, switch the Diffuse BSDF shader with a Mix Shader node, and label it as Mix Shader2. In the first Shader input socket, select a Mix Shader node and label it as Mix Shader1, and in the second one, select an Add Shader node.
Go to the Mix Shader1 node, and in the first Shader input socket, load a Diffuse BSDF node, and in the second one, load a Glossy BSDF node. Change the Glossy BSDF shader node's Distribution to Ashikhmin-Shirley, and set the Roughness value to 0.100.
Add a Subsurface Scattering node (press Shift + A and navigate to Shader | Subsurface Scattering). Set the Falloff value to Gaussian, the Scale value to 0.060, and the Radius values to 4.000, 2.000, and 1.000 (top to bottom).
Connect the Mix Shader1 output to the first Shader input socket of the Add Shader node, and the output of the Subsurface Scattering node to the second Shader input socket of the Add Shader node.
Add a Layer Weight node (press Shift + A and navigate to Input | Layer Weight) and connect its Facing output to the Fac input socket of the Mix Shader2 node. Set the Blend value to 0.100.
Add a Fresnel node (press Shift + A and navigate to Input | Fresnel) and connect its output to the Fac input socket of the Mix Shader1 node. Set the IOR value to 5.950 as shown in the following screenshot:
The basic shader nodes
Add a Texture Coordinate node (press Shift + A and navigate to Input | Texture Coordinate), a Mapping node (press Shift + A and navigate to Vector | Mapping), and a Voronoi Texture node (press Shift + A and navigate to Texture | Voronoi Texture). Connect the Object output of the Texture Coordinate node to the Vector input socket of the Mapping node, and the output of this to the Vector input of the Voronoi Texture node. Set the Scale value of the Mapping node to 1.500 for the three axes.
Add three ColorRamp nodes (press Shift + A and navigate to Converter | ColorRamp) and label them as ColorRamp1, ColorRamp2, and ColorRamp3. Connect the Color output of the Voronoi Texture node to the Fac input sockets of the three ColorRamp nodes.
In the ColorRamp1 node, set Interpolation to B-Spline, the black color stop to the 0.400 position, and the white color stop to the 0.700 position. In the ColorRamp2 node, set Interpolation to B-Spline as well. Leave the black color stop at the 0.000 position, and move the white color stop to the 0.300 position. In the ColorRamp3 node, set Interpolation to Cardinal, leave the black color stop at the 0.000 position, and move the white color stop to the 0.805 position.
Add a MixRGB node (press Shift + A and navigate to Color | MixRGB), set Blend Type to Add and the Fac value to 1.000, and then connect the Color output of the ColorRamp1 node to the Color1 input socket, and the Color output of the ColorRamp2 node to the Color2 input socket.
Press Shift + D to duplicate the Add node and change Blend Type of the duplicate to Multiply. Connect the output of the Add node to the Color1 input socket, and the Color output of the ColorRamp3 node to the Color2 input socket.
Add a Bump node (press Shift + A and navigate to Vector | Bump) and connect the output of the Multiply node to the Height input socket of the Bump node. Connect the Normal output of this to the Normal input sockets of the Diffuse BSDF, Glossy BSDF, and Subsurface Scattering nodes. Enable the Invert option on the Bump node, as shown in the following screenshot:
The Bump node
Now, box-select (press the B key) the Texture Coordinate node and the Mapping nodes, and move them to the left to make room for new nodes.
Add a MixRGB node (press Shift + A and navigate to Color | MixRGB) and label it as Vector_deform. Paste it between the Mapping and Voronoi Texture nodes.
Add a Noise Texture node (press Shift + A and navigate to Texture | Noise Texture), connect to its Vector input socket the Mapping node output, and set the Scale value to 7.200. Connect the Noise Texture node's Color output to the Color2 input socket of the Vector_deform node. Set the Fac value of the Vector_deform node to 0.080, as shown in the following screenshot:
Deforming the mapping coordinates of the bump textures through a procedural noise
Add an RGB node (press Shift + A and navigate to Input | RGB) and a new MixRGB node (press Shift + A and navigate to Color | MixRGB). Label the MixRGB node
as Color_Diffuse.
Press Shift + D to duplicate the Color_Diffuse node and label the duplicate as Color_Glossy.
Connect the Color_Diffuse node's output to the Color input socket of the Diffuse BSDF shader node, and the Color_Glossy node's output to the Color input socket of the Glossy BSDF shader node.
Connect the output of the RGB node to the Color1 input sockets of both the Color_Diffuse and Color_Glossy nodes. Connect the RGB node also to the Color input socket of the Subsurface Scattering node.
Press Shift + D to duplicate the Color_Diffuse node, set Blend Type of the duplicate to Multiply, and label it as Multiply_Diffuse; then, paste it between the Color_Diffuse and Diffuse BSDF shader nodes.
Connect the Color output of the ColorRamp2 node to the Color2 input socket of the Multiply_Diffuse node. Set the Fac value of this to 0.770.
Go to the Color_Diffuse node and set the Fac value to 0.830, and change the Color2 value of R to 0.315, G to 0.500, and B to 0.130.
Go to the Color_Glossy node and set the Fac value to 0.770, and change the Color2 values of R to 0.860, G to 0.611, and B to 0.203.
Go to the RGB node and set the Color values for R to 0.900, G to 0.123, and B to 0.395, as shown in the following screenshot:
Adding the color nodes
Save the file as 9931OS_organic.blend.
How it works...
From step 1 to 7, we built a shader that is very similar to the shaders that we have already seen for SSS_materials.
From step 8 to 13, we built the bump pattern by using a single Voronoi Texture node tuned through three ColorRamp nodes with different settings.
From step 14 to 16, we added, through the very low value of a MixRGB node, the values of a Noise Texture node to the vector of the Voronoi Texture node to obtain a less regular pattern.
From step 17 to 25, we built the color pattern by establishing a base color by the RGB node and introducing a variation through the MixRGB nodes connected to the Color input sockets of the shader components. Note that the base pink color set in the RGB node goes straight to the SSS node. The MixRGB varied greenish color is multiplied by one of the bump outputs and then goes to the diffuse component of the shader, while the varied yellowish color is for the glossy component instead.