This post is the second in a series about procedural wood for Blender Cycles. I’m starting right where I left off last time, so if you haven’t read the last post, please do:
Procedural Wood Shaders in Cycles, the Beginning.
At the end of the last post, we finally reached a point that sort of kind of almost looked like wood. I promised we’d make it better, so I think a fun first step would be to add some color. We’re going to use a ColorRamp node to do it, though there are other possibilities. Make some space between the Modulo node and the Diffuse BSDF node, then add the ColorRamp (Add->Converter->ColorRamp) and plug it in between the two:
Your render won’t change at all. The color values that we got from the Modulo node were in the range 0 to 1, which is exactly the range of the ColorRamp…so 0 = black on the left end, and 1 = white on the right end.
One thing that bothers me about our wood right now is that the center is dark. I think the center of each ring should be light, and the edges of rings should be the darkest part. To fix that, click the double-headed arrow on the ColorRamp node, to the left of the RGB dropdown. Now black is on the right, and the wood already looks better.
Click on the little house-shaped box on the left end (1), and then click on the colored area at the bottom of the node (2).
Choose the Hex option and type in the value FEDFC8. Now click the house-shaped box on the right end (3), and click the colored area at the bottom of the node (2). Again choose the Hex option and type in the value 876658. You can change those values at any point if you don’t like the color of the wood we’re making. I’d recommend sampling photos of real wood, because I’ve found it hard to guess realistic wood colors.
Now, tighten up the grain by selecting the left end color again, and in the “Pos” box, type .75. Your node should look like this:
And your render should look like this:
Let’s kick it up a notch. Remember last time, we used the equation for a circle to get the growth rings: x^2 + y^2. Well, it’s too perfectly circular and doesn’t look real.
What if we made them elliptical? Fortunately, the equation for an ellipse isn’t too different: ( x^2 / a^2 ) + ( y^2 / b^2 ). For those of you with math anxiety, don’t fret! It’s just dividing the x^2 and y^2 terms by the width and height of the ellipse. We can easily add that control to our node graph using the Math node again, but with the “Divide” function. Add two Math nodes (Add->Converter->Math), set the function to “Divide”, and set the bottom Value to 1.0. Insert these two nodes between the Multiply and Add nodes, like this:
Try changing one of the Value of one (or both) of the Divide nodes to 0.5 or 2.0, and you can see how we can now reshape our rings so they’re not perfect circles.
But who am I trying to kid? Oval is just barely better than circular. We really need the rings to be more random. Fortunately, there’s a node for that! A really fun thing about nodes is that they’ll take anything as input…so you can plug a Vector into a color, or split an RGB color into XYZ values. That means a nice way to get randomness is to use a Noise texture. Add a Noise texture node (Add->Texture->Noise), and plug its Color output into one of the Divide node’s Value input:
Whoa! Now THAT is cool!
But it’s too squiggly. You can tweak the values in a lot of ways to get different effects, but for now, set the Noise Scale to 1.0, the Detail to 5.0, and the Distortion to 10.0. Add another Noise texture node and plug it into the other Divide node (tip: You can copy and paste the Noise node you already have, and just drag it to the right spot).
Now you can see that the end-grain pattern of your plank is no longer perfect circles, and if you rotate your render a bit you can see that we have a pretty neat looking grain pattern going down the sides too.
Here’s the complete node setup up to now:
Not too shabby…but still not there yet. Feel free to play with the colors and noise settings to see what you can come up with. Try adding more colors to your color ramp, and adjusting the location of the color markers! For example, if you don’t like the hard-edged grain pattern, you can make it “fuzzy” by moving the dark colored marker to the middle and adding another light-colored marker at the end, like this:
This is a point where the technical aspects of the shader can give way to artistry. Have fun with it, and next time we’ll take another big step by adding grain to the wood!
The images are not showing and the URLs point to a shoe shop?!
Oh no!!! When I switched to a new URL I only spot-checked some of the pages instead of all of them. I fixed the first few tutorials and will go through and update all of the images and links that are broken. I apologize and hope you will come back and check out my site again some day.