In this recipe, we will create a generic wood material—a shader that can be easily adapted to different situations—as shown in the following screenshot:
The procedural wood material as it appears in the final rendering
Getting ready...
Start Blender and load the 9931OS_Suzanne_start.blend file. Then perform these steps:
Go to the World window and click on the button with a dot icon to the right of the Color slot under the Surface subpanel. In the pop-up menu, select the Environment Texture item.
Click on the Open button and browse to the textures folder to load the Barce_Rooftop_C_3K.hdr image.
Set the Strength value to 0.300. Then go back to the Material window.
Go to the Camera view and add a Cube primitive to the scene. Place it leaning on the Plane, to the right of Suzanne. Move it up by 1 Blender unit.
With the mouse arrow in the Camera view, press Shift + F to enter Walk Mode. Adjust the Camera position to center the two objects in the frame.
Select the Cube, go to Edit Mode, and scale it to at least twice its current size. Exit Edit Mode, and using the 3D manipulator widget (which can be enabled in the 3D view toolbar), move the Cube upwards to stay nicely on the Plane. Press N, and in the Properties panel, select the Lock Camera to View item. Then adjust the Camera position framing the two objects.
Assign a Bevelmodifier to the Cube, set Width to 0.0450, and set the Segments value to 4.
Press T to call the Tool Shelf panel. Set the Cube shading to Smooth.
Select Suzanne and rotate it a bit towards the left on the z axis.
Press T to close the Tool Shelf panel.
Setting up the scene
How to do it...
Now we are going to create the material by performing the following steps:
Click on New in the Material window under the Properties panel or in the Node Editor toolbar. Rename the material Wood.
Switch the Diffuse BSDF shader with a Mix Shader node, and in the first Shader slot, select a Diffuse BSDF shader. In the second Shader slot, select a Glossy BSDF node. Set the Glossy BSDF node's Roughness value to 0.300.
Add a Fresnel node (press Shift + A and navigate to Input | Fresnel) and a MixRGB node (press Shift + A and navigate to Color | MixRGB). Set the IOR value of the Fresnel node to 2.000. Connect its output to the Color1 input socket of the MixRGB node. Set the MixRGB node's Blend Type to Multiply, label it as Multiply1, and set the Fac value to 0.900. Connect the Multiply1 node's output to the Fac input socket of the Mix Shader node.
Add Frame (press Shift + A and navigate to Layout | Frame). Select the Diffuse BSDF, Glossy BSDF, Mix Shader, Multiply1, and Fresnel nodes. Then select the Frame and press Ctrl + P to parent them. Label the frame as SHADERS.
Add one Texture Coordinate node (press Shift + A and navigate to Input | Texture Coordinate) and three Mapping nodes (press Shift + A; navigate to Vector | Mapping; add the first node; duplicate the other nodes; and then label them as Mapping1, Mapping2, and Mapping3). Connect the Object output of the Texture Coordinate node to the Vector input of the three Mapping nodes.
Set the Scalevalue of the Mapping1 node to 2.000 for all the three axes. Set the Scale value only for the x axis of the Mapping2 node to 20.000. Then set the Scale value only for the x axis of the Mapping3 node to 15.000.
Add a Noise Texture node (press Shift + A and navigate to Texture | Noise Texture) and two Wave Texture nodes (press Shift + A and navigate to Texture | Wave Texture). Label them as Noise Texture1, Wave Texture1, and Wave Texture2.
Set the Scale of the Noise Texture1 node to 6.000 and Detail to 0.000. Connect the Mapping1 node's output to the Noise Texture node's Vector input socket.
Connect the Mapping2 node's output to the Vector input of the Wave Texture1 node. Set the Wave Texture1 node's Scale value to 0.200 and Distortion to 20.000.
Connect the Mapping3 node output to the Wave Texture2 node's Vector input socket. Set Wave Type to Rings, the Scale value to 0.070, and the Distortion value to 44.000.
Add a MixRGB node (press Shift + A and navigate to Color | MixRGB). Set the Blend Type to Multiply (label it as Multiply1) and the Fac value to 1.000. Connect the Noise Texture node's Color output to the Color1 input socket and the Wave Texture1 node's Color output to the Color2 input socket.
Connect the Multiply1 node's output to the Color input of the Diffuse BSDF shader. Press Shift + D to duplicate it, change the Blend Type to Add, and paste it between the Multiply1 node and the Diffuse BSDF shader node. Connect the Wave Texture2 node's Color output to the Color2 input socket of this Add-MixRGB node (labelled as Add1).
Add a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp), label it as ColorRamp1, and paste it right after the Noise Texture1 node. Set Interpolation to B-Spline and move the black color stop to the 0.345 position.
Press Shift + D to duplicate the ColorRamp1 node, paste it right after the Wave Texture1 node, and label it as ColorRamp2. Move the black color stop to the 0.505 position and the white color stop to the 0.975 position.
Press Shift + D to duplicate the ColorRamp2, label it as ColorRamp3, and paste it right after the Wave Texture2 node. Move the black color stop to the 0.495 position and the white color stop to the left end of the slider, and set Pos as 0.000, as shown in the following screenshot:
The textures required to draw the wood effect summed and connected to the shader part of the material
Now add a MixRGB node (press Shift + A and navigate to Color | MixRGB) and connect the Add1 node's Color output to its Fac input socket. Set the Color1 values of R to 1.000, G to 0.500, and B to 0.150. Set the Color2 values of R to 0.694, G to 0.205, and B to 0.027.
Press Shift + D to duplicate the MixRGB node. Paste the duplicate right after the original node. Connect the MixRGB node's output to the Color2 input socket, change Blend Type to Multiply, and label it as Multiply3.
Add a Frame (press Shift + A and navigate to Layout | Frame). Press Shift and select the three texture nodes, the three ColorRamp nodes, the four MixRGB nodes, and then the Frame. Press Ctrl + P to parent them. Label the frame as COLOR, as shown in the following screenshot:
Adding more color to the veining
Add a new Noise Texture node (press Shift + A, navigate to Texture | Noise Texture, and label it as Noise Texture2), a Math node (press Shift + A and navigate to Converter | Math), and a Bump node (press Shift + A and navigate to Vector | Bump).
Connect theMapping3 node's output to the Vector input socket of the Noise Texture2 node. Then connect the Color output of this node to the second Value input of the Math node. Set its Operation to Add, label it as Add2, and connect its output to the Height input socket of the Bump node.
Set the Bump node's Strength value to 0.200. Connect the Normal output of the Bump node to the Normal input of the Fresnel, Diffuse BSDF, and Glossy BSDF nodes inside the SHADERS frame. Set the Noise Texture2 node's Scale value to 43.000 and Detail to 16.000.
Go to the Add1 node inside the COLOR frame, click on the output node, and drag it so that it is connected to the first Value input socket of the Add2-Math node.
Add a Frame (press Shift + A and navigate to Layout | Frame). Select the three nodes and then the Frame. Press Ctrl + P to parent them. Label the frame as BUMP, as shown in the following screenshot:
The bump pattern, based in part on the output of the veining
Save the file as Wood.blend.
How it works...
From steps 1 to 4, we built the basic shader using the usual Diffuse BSDF and Glossy BSDF nodes, mixed by a Fresnel value and multiplied by the values of a medium gray color.
From steps 5 to 18, we built the color of the wood's veins, adding three procedurals to be used as splitting factors for the two wood colors set in the penultimate MixRGB node. Using the last Multiply3 node, we made the color more saturated (actually, we multiplied the values by themselves).
From steps 19 to 23, we built the bump using a noise grain summed to the veins' values by the Add2-Math node. We set a low value for the bump's Strength value, but you can use higher values (together with higher roughness values) to obtain less polished surfaces, which can give you different kinds of wood in the output.