{"id":223,"date":"2017-06-11T19:48:15","date_gmt":"2017-06-12T02:48:15","guid":{"rendered":"http:\/\/www.artifisizzler.com\/?p=223"},"modified":"2019-07-18T01:19:37","modified_gmt":"2019-07-18T01:19:37","slug":"important-im-still-learning-too","status":"publish","type":"post","link":"http:\/\/www.decscroll.com\/blog\/2017\/06\/11\/important-im-still-learning-too\/","title":{"rendered":"IMPORTANT: I&#8217;m Still Learning Too!"},"content":{"rendered":"<p>It&#8217;s been a while since my last post, and I was thinking I really need to get back into this. Fortunately, the Universe responded with a swift kick in the pants in the form of an astute reader named Ethos. Ethos has experience in woodworking, and not only asked me some great questions about the Red Oak shader, but also pointed out some areas where it wasn&#8217;t quite realistic. One of these is the fact that the ring spacing decreases exponentially as the rings get farther from the core of the wood, but real wood rings are pretty uniformly spaced. I&#8217;d noticed the thinner and thinner rings in my shader, but didn&#8217;t realize it was unrealistic so I didn&#8217;t spend much time thinking about it. Since Ethos pointed it out to me, I decided to try to fix it. After some experimentation, I realized the cause of the error was quite simple and should&#8217;ve been obvious earlier.<\/p>\n<p>If you started in the first post (<a href=\"http:\/\/www.decscroll.com\/?p=6\">Procedural Wood Shaders in Cycles, The Beginning<\/a>), or read my post about a couple of other ways to make rings, you might remember that I described the rings with the equation of a circle. I stated it as <img decoding=\"async\" src=\"http:\/\/s0.wp.com\/latex.php?latex=x%5E2+%2B+y%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"x^2 + y^2\" class=\"latex\" \/>, which means I left out a very important part! The <em>full<\/em> equation of a circle is <img decoding=\"async\" src=\"http:\/\/s0.wp.com\/latex.php?latex=x%5E2+%2B+y%5E2+%3D+r%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"x^2 + y^2 = r^2\" class=\"latex\" \/>, where r is the radius of the circle. I thought I could ignore the radius because we&#8217;re not really rendering just a circle, but rather a solid cylindrical shading where the radius goes from 0 to 1 (repeated over and over via the Modulo operator). However the fact that r is <em>squared<\/em> is quite important. If you recall from algebra, the equation <img decoding=\"async\" src=\"http:\/\/s0.wp.com\/latex.php?latex=y+%3D+x%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"y = x^2\" class=\"latex\" \/> looks like this:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/parab1.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-227\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/parab1.png?resize=288%2C306\" alt=\"parab1\" width=\"288\" height=\"306\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/parab1.png?w=288 288w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/parab1.png?resize=282%2C300 282w\" sizes=\"auto, (max-width: 288px) 100vw, 288px\" \/><\/a><\/p>\n<p>I drew some blue lines on to indicate what might be the rings, and you can see that the rings get gradually closer and closer together:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/parab2.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-228\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/parab2.png?resize=288%2C306\" alt=\"parab2\" width=\"288\" height=\"306\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/parab2.png?w=288 288w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/parab2.png?resize=282%2C300 282w\" sizes=\"auto, (max-width: 288px) 100vw, 288px\" \/><\/a><\/p>\n<p>So if we want the rings to be evenly-spaced, we need to get rid of that squared value, and we do that by taking the square root. There&#8217;s no &#8220;Square Root&#8221; Math function in Blender, but fortunately a square root is the same as raising a number to the <img decoding=\"async\" src=\"http:\/\/s0.wp.com\/latex.php?latex=%5Cfrac%7B1%7D%7B2%7D&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"&#92;frac{1}{2}\" class=\"latex\" \/> power. There <em>is<\/em> a &#8220;Power&#8221; Math function that we can use. So, we need to change our <img decoding=\"async\" src=\"http:\/\/s0.wp.com\/latex.php?latex=x%5E2+%2B+y%5E2&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"x^2 + y^2\" class=\"latex\" \/> into <img decoding=\"async\" src=\"http:\/\/s0.wp.com\/latex.php?latex=%28x%5E2+%2B+y%5E2%29%5E%5Cfrac%7B1%7D%7B2%7D&#038;bg=ffffff&#038;fg=000&#038;s=0&#038;c=20201002\" alt=\"(x^2 + y^2)^&#92;frac{1}{2}\" class=\"latex\" \/>. This was the node network we ended up with at the end of part 1:<\/p>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-720 aligncenter\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-011.png?resize=640%2C432\" alt=\"\" width=\"640\" height=\"432\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-011.png?w=761 761w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/04\/basic-wood-011.png?resize=300%2C203 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>We need to insert the Power node before the Modulo node, like this:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix01.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-234\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix01.png?resize=640%2C275\" alt=\"ring-power-fix01\" width=\"640\" height=\"275\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix01.png?w=973 973w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix01.png?resize=300%2C129 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix01.png?resize=768%2C330 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>And rendering we get this:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix02.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-235\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix02.png?resize=395%2C393\" alt=\"ring-power-fix02\" width=\"395\" height=\"393\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix02.png?w=395 395w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix02.png?resize=150%2C150 150w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix02.png?resize=300%2C298 300w\" sizes=\"auto, (max-width: 395px) 100vw, 395px\" \/><\/a><\/p>\n<p>However, you can see that it messed up the scale. This is actually a good problem. Because our radius was exponential, the Scale of the overall shader was ramping up at a greater rate, and things like noise needed to be applied sparingly or they would quickly get out of control. Now that we&#8217;ve got uniformly-spaced rings, everything should behave better. If you bump the Scale in the Mapping node up to 5.0 instead of 2.0, you should get a similar look to what we had before.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix03.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-236\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix03.png?resize=428%2C399\" alt=\"ring-power-fix03\" width=\"428\" height=\"399\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix03.png?w=428 428w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix03.png?resize=300%2C280 300w\" sizes=\"auto, (max-width: 428px) 100vw, 428px\" \/><\/a><\/p>\n<p>If you&#8217;ve followed through to the end of the shader, you can insert the Power node right before the Modulo node in the Rings section:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix04.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-239\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix04.png?resize=640%2C373\" alt=\"ring-power-fix04\" width=\"640\" height=\"373\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix04.png?w=903 903w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix04.png?resize=300%2C175 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/06\/ring-power-fix04.png?resize=768%2C447 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>So, yes, this was a pretty egregious mistake, but it was an awesome opportunity for me to learn and understand more. Thanks again to Ethos for pointing this out and helping to make our Red Oak shader even better!! Please, if you have comments or questions, reach out to me via the Contact form on the <a href=\"http:\/\/www.decscroll.com\/blog\/about\/\">About<\/a> page.<\/p>\n<p>Another idea of Ethos&#8217; that I hope to explore in a future post is the fact that trees get narrower towards the top, so the rings will get closer together (uniformly of course) down the length of a long board. Hopefully I&#8217;ll work on that soon so there&#8217;s not such a long time between posts. Thanks for reading!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s been a while since my last post, and I was thinking I really need to get back into this. Fortunately, the Universe responded with a swift kick in the pants in the form of an astute reader named Ethos. Ethos has experience in woodworking, and not only asked me some great questions about the&#8230;<\/p>\n","protected":false},"author":2,"featured_media":236,"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":true,"_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":true,"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-223","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\/2017\/06\/ring-power-fix03.png?fit=428%2C399","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paMavh-3B","_links":{"self":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/223","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=223"}],"version-history":[{"count":4,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/223\/revisions"}],"predecessor-version":[{"id":738,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/223\/revisions\/738"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/media\/236"}],"wp:attachment":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/media?parent=223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/categories?post=223"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/tags?post=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}