{"id":14,"date":"2016-04-17T18:17:53","date_gmt":"2016-04-18T01:17:53","guid":{"rendered":"http:\/\/artifisizzler.com\/?p=14"},"modified":"2019-07-18T01:07:49","modified_gmt":"2019-07-18T01:07:49","slug":"procedural-wood-shaders-in-cycles-part-2","status":"publish","type":"post","link":"http:\/\/www.decscroll.com\/blog\/2016\/04\/17\/procedural-wood-shaders-in-cycles-part-2\/","title":{"rendered":"Procedural Wood Shaders in Cycles, part 2"},"content":{"rendered":"<p>This post is the second in a series about procedural wood for Blender Cycles. I&#8217;m starting right where I left off last time, so if you haven&#8217;t read the last post, please do:<\/p>\n<p><a href=\"http:\/\/decscroll.com\/?p=6\">Procedural Wood Shaders in Cycles, the Beginning.<\/a><\/p>\n<p>At the end of the last post, we finally reached a point that sort of kind of almost looked like wood. I promised we&#8217;d make it better, so I think a fun first step would be to add some color. We&#8217;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-&gt;Converter-&gt;ColorRamp) and plug it in between the two:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-723 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-012.png?resize=597%2C320\" alt=\"\" width=\"597\" height=\"320\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-012.png?w=597 597w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-012.png?resize=300%2C161 300w\" sizes=\"auto, (max-width: 597px) 100vw, 597px\" \/><\/p>\n<p>Your render won&#8217;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&#8230;so 0 = black on the left end, and 1 = white on the right end.<\/p>\n<p>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.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-724 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-013.png?resize=251%2C295\" alt=\"\" width=\"251\" height=\"295\" \/><\/p>\n<p>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).<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-725 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-013c.png?resize=251%2C295\" alt=\"\" width=\"251\" height=\"295\" \/><\/p>\n<p>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&#8217;t like the color of the wood we&#8217;re making. I&#8217;d recommend sampling photos of real wood, because I&#8217;ve found it hard to guess realistic wood colors.<\/p>\n<p>Now, tighten up the grain by selecting the left end color again, and in the &#8220;Pos&#8221; box, type .75. Your node should look like this:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-726 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-014.png?resize=375%2C334\" alt=\"\" width=\"375\" height=\"334\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-014.png?w=375 375w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-014.png?resize=300%2C267 300w\" sizes=\"auto, (max-width: 375px) 100vw, 375px\" \/><\/p>\n<p>And your render should look like this:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-727 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-015-1.png?resize=468%2C454\" alt=\"\" width=\"468\" height=\"454\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-015-1.png?w=468 468w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-015-1.png?resize=300%2C291 300w\" sizes=\"auto, (max-width: 468px) 100vw, 468px\" \/><\/p>\n<p>Let&#8217;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&#8217;s too perfectly circular and doesn&#8217;t look real.<\/p>\n<p>What if we made them elliptical? Fortunately, the equation for an ellipse isn&#8217;t too different: ( x^2 \/ a^2 ) + ( y^2 \/ b^2 ). For those of you with math anxiety, don&#8217;t fret! It&#8217;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 &#8220;Divide&#8221; function. Add two Math nodes (Add-&gt;Converter-&gt;Math), set the function to &#8220;Divide&#8221;, and set the bottom Value to 1.0. Insert these two nodes between the Multiply and Add nodes, like this:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-728 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-016.png?resize=591%2C386\" alt=\"\" width=\"591\" height=\"386\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-016.png?w=591 591w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-016.png?resize=300%2C196 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-016.png?resize=350%2C230 350w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/p>\n<p>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&#8217;re not perfect circles.<\/p>\n<p>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&#8217;s a node for that! A really fun thing about nodes is that they&#8217;ll take anything as input&#8230;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-&gt;Texture-&gt;Noise), and plug its Color output into one of the Divide node&#8217;s Value input:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-729 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-017.png?resize=372%2C332\" alt=\"\" width=\"372\" height=\"332\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-017.png?w=372 372w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-017.png?resize=300%2C268 300w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/p>\n<p>Whoa! Now THAT is cool!<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-730 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-018.png?resize=474%2C451\" alt=\"\" width=\"474\" height=\"451\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-018.png?w=474 474w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-018.png?resize=300%2C285 300w\" sizes=\"auto, (max-width: 474px) 100vw, 474px\" \/><\/p>\n<p>But it&#8217;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).<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-731 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-019.png?resize=371%2C546\" alt=\"\" width=\"371\" height=\"546\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-019.png?w=371 371w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-019.png?resize=204%2C300 204w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-019.png?resize=300%2C442 300w\" sizes=\"auto, (max-width: 371px) 100vw, 371px\" \/><br \/>\nNow 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.<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-732 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020-1.png?resize=640%2C347\" alt=\"\" width=\"640\" height=\"347\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020-1.png?w=859 859w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020-1.png?resize=300%2C163 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020-1.png?resize=768%2C417 768w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020-1.png?resize=850%2C461 850w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Here&#8217;s the complete node setup up to now:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-733 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020b.png?resize=640%2C252\" alt=\"\" width=\"640\" height=\"252\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020b.png?resize=1024%2C403 1024w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020b.png?resize=300%2C118 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020b.png?resize=768%2C302 768w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020b.png?resize=850%2C335 850w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020b.png?w=1516 1516w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020b.png?w=1280 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Not too shabby&#8230;but still not there yet. Feel free to play with the colors and noise settings\u00a0to see what you can come up with. Try adding\u00a0more colors to your color ramp, and adjusting the location of the color markers! For example, if you don&#8217;t like the hard-edged grain pattern, you can make it &#8220;fuzzy&#8221;\u00a0by\u00a0moving the dark colored marker to the middle and adding another light-colored marker at the end, like this:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-734 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-021.png?resize=387%2C331\" alt=\"\" width=\"387\" height=\"331\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-021.png?w=387 387w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-021.png?resize=300%2C257 300w\" sizes=\"auto, (max-width: 387px) 100vw, 387px\" \/><\/p>\n<p>This is a point where the technical\u00a0aspects of the shader can give way to artistry. Have fun with it, and next time we&#8217;ll take another big step by adding grain to the wood!<\/p>\n<p><a href=\"http:\/\/www.decscroll.com\/?p=34\">Continue To Part 3!<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is the second in a series about procedural wood for Blender Cycles. I&#8217;m starting right where I left off last time, so if you haven&#8217;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&#8230;<\/p>\n","protected":false},"author":2,"featured_media":75,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[3],"tags":[4,8,13,15,16],"class_list":["post-14","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-blender","tag-cycles","tag-shader","tag-tutorial","tag-wood"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-020.png?fit=859%2C466","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paMavh-e","_links":{"self":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/14","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/comments?post=14"}],"version-history":[{"count":3,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/14\/revisions"}],"predecessor-version":[{"id":735,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/14\/revisions\/735"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/media\/75"}],"wp:attachment":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/media?parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/categories?post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/tags?post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}