Ok, if you’ve followed the last two posts, we have a start on a wood shader, but it’s not there yet. Check out the first two parts if you haven’t yet:

Procedural Wood Shaders in Cycles, the Beginning.

Procedural Wood Shaders in Cycles, part 2

To make it better, we have to look at some real wood. For this example I’m looking at red oak. The grain in red oak is actually tiny little tubes that run down the length of the trunk. In fact, you can blow air THROUGH the grain of oak with an air compressor! This is what the end-grain of red oak looks like, and you can clearly the see the holes there.


So how do we do that? As you may have guessed, there is already a node that can help us: Voronoi Texture. You often see Voronoi diagrams as a set of packed polygonal cells, but the Blender node also has ‘Intensity’ mode. This generates a circular gradient in the middle of each cell, so the output is like a bunch of randomly-packed circular blobs. This is perfect because we want randomness in our grain! Add a Voronoi Texture node and connect its output directly to the Diffuse BSDF input.


Set the Scale of the Voronoi Texture node to 150 and it should look like this when you render:


We’ve got nice spots now, but they’re all over the plank. What we really want is for them to be more like cylinders, so we want to be able to stretch it along the Y-axis independent of other directions. Luckily we’ve already split out our X, Y, and Z components so we can easily add a Multiply node to change just the Y value. In my case, the scale of my plank means I can set the Multiply value to 0 for now, but if I ever change the scale of my object I’d like to be able to adjust the Y-scale of my grain.

To plug that into the Voronoi Texture node, we need to recombine the X, Y, and Z components using the Combine XYZ node. Add one to your graph, and then connect the X and Z from the old Separate XYZ node, and the Y from the Multiply node we just added. Then, connect the Combine XYZ output to the Voronoi Texture node. It should look like this:


And the render now looks like this:


Nice. That’s more like what we need. So to integrate the grain into our texture, we actually need to go back to black-and-white for a moment…sorry! Take the Color Ramp node and change the left color to black (Hex 000000) and the right color to white (Hex FFFFFF). Move the left color to 0.5, and set the type to B-Spline. It should look like this:


Now add a Math node and set the Operation to Divide. Plug the output of the Color Ramp node into the top input, and the output of the Voronoi Texture node into the bottom input. Plug the output of the Divide node into the Diffuse BSDF, like this:


Rendering, you get this:

The “Divide” operation, as the name implies, divides the output value of the Color Ramp (i.e., our Rings) by the Voronoi Texture values. Since our rings went from white to black, that’s 1.0 down to 0.0. So the Voronoi pattern gradually divides that value and it makes the pattern concentrated heavily by the edge of the rings, and get smaller and more sparse as they get farther from the rings. That’s getting closer to the way real oak grain looks.


It’s a bit too heavy, so we can lighten it up a bit by shifting the pattern. Another math node to the rescue! Add a Math node with operation Subtract, and plug it in between the Divide node and the Diffuse node. Set the second value to 2.0.


If you render again and look at the end grain, you can see that the Voronoi pattern has moved toward the ring edge, where it gets cut off.


Moving by 2 units gives us a grain that’s not too dense. You can play with that value to get different looks. Overall, that’s a pretty cool-looking wood, except that it’s black and white. It only took 3 posts!


Adding some color is easy enough. Add a MixRGB node, between the last Subtract node and the DiffuseBSDF node. Plug the output of the Subtract into the Fac input, and the Color output of the Mix node into the Color input of DiffuseBSDF. Set the two colors of the Mix node to Hex BCA187 and Hex 876658, respectively, like so:


Your render should look like this…NOW we’re finally getting somewhere!


One last  bit of magic: since our grain pattern is black-and-white, we can use it for displacement as well! It’s going to be too strong, so create a Multiply (Math) node and connect one input from the output of the Subtract node. Set the other input to 0.01, and then connect the output to the Displacement input of the very last node:


That adds just a little bit of depth to the grain that’ll catch the light and give us a touch more realism.


The complete node tree so far is:


Thanks for reading this far! Next time, we’ll try adding some more details based on actual wood…stay tuned!

Continue to Part 4