{"id":109,"date":"2016-05-19T11:49:23","date_gmt":"2016-05-19T18:49:23","guid":{"rendered":"http:\/\/artifisizzler.com\/?p=109"},"modified":"2019-03-11T01:39:54","modified_gmt":"2019-03-11T01:39:54","slug":"a-slight-diversion-cleanup","status":"publish","type":"post","link":"http:\/\/www.decscroll.com\/blog\/2016\/05\/19\/a-slight-diversion-cleanup\/","title":{"rendered":"A Slight Diversion: Cleanup"},"content":{"rendered":"<p>It occurred to me that as our shader gets more complicated, we haven&#8217;t really been doing anything to make it neater. I&#8217;d like to take a few moments to clean it up a bit before we go any farther. As you make your own shaders this is a good habit, especially if you want to share them with others.<\/p>\n<p>We should&#8217;ve done this in the first post, but the first step is to name our material! It&#8217;s still &#8220;Material&#8221; and that&#8217;s a terrible name. So, first, rename it to &#8220;RedOak&#8221; or something similar (&#8220;red_oak&#8221;, &#8220;oak_wood_red&#8221;, etc.). I tend to name my shaders with my initials, like so: &#8220;DECWood_RedOak&#8221;. Just make sure it&#8217;s descriptive.<\/p>\n<p>Next, let&#8217;s clean up the node graph a bit. Select the nodes that pertain to our newly-added Rays, and move them slightly down and away from the other nodes:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-01.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-110\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-01.png?resize=588%2C243\" alt=\"basic-wood-05-01\" width=\"588\" height=\"243\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-01.png?w=1089 1089w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-01.png?resize=300%2C124 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-01.png?resize=768%2C318 768w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-01.png?resize=1024%2C424 1024w\" sizes=\"auto, (max-width: 588px) 100vw, 588px\" \/><\/a><\/p>\n<p>Also note that I&#8217;ve lined them up neatly and moved the Multiply node so that the connection doesn&#8217;t cross any nodes. Now add a Frame (Add-&gt;Layout-&gt;Frame). Deselect the Frame, and select all the other nodes. Push &#8216;G&#8217; to Translate them (just like objects in the Viewport) and drag them onto the Frame. The Frame should expand to hold all the nodes like this:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-02.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-111\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-02.png?resize=594%2C186\" alt=\"basic-wood-05-02\" width=\"594\" height=\"186\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-02.png?w=1030 1030w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-02.png?resize=300%2C94 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-02.png?resize=768%2C240 768w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-02.png?resize=1024%2C320 1024w\" sizes=\"auto, (max-width: 594px) 100vw, 594px\" \/><\/a><\/p>\n<p>The open the Node property pane (press &#8216;N&#8217;), and change the Label to Rays. Also check the &#8220;Color&#8221; checkbox and choose a color for the frame. I chose a green color; you can choose whatever you like or even leave it gray:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-03.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-112\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-03.png?resize=187%2C414\" alt=\"basic-wood-05-03\" width=\"187\" height=\"414\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-03.png?w=187 187w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-03.png?resize=136%2C300 136w\" sizes=\"auto, (max-width: 187px) 100vw, 187px\" \/><\/a><\/p>\n<p>I think it might also make sense to encapsulate our nodes that make the rings, which are these:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-04.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-113\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-04.png?resize=598%2C375\" alt=\"basic-wood-05-04\" width=\"598\" height=\"375\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-04.png?w=997 997w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-04.png?resize=300%2C188 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-04.png?resize=768%2C481 768w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/a><\/p>\n<p>Repeat the same steps: Add a Frame, then drag and drop the nodes onto the Frame. Add a label of &#8220;Rings&#8221; and choose a color:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-05.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-114\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-05.png?resize=598%2C386\" alt=\"basic-wood-05-05\" width=\"598\" height=\"386\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-05.png?w=1012 1012w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-05.png?resize=300%2C194 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-05.png?resize=768%2C496 768w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/a><\/p>\n<p>Lastly, I grouped these five nodes into a &#8220;Grain&#8221; Frame:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-07.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-115\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-07.png?resize=598%2C252\" alt=\"basic-wood-05-07\" width=\"598\" height=\"252\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-07.png?w=1111 1111w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-07.png?resize=300%2C126 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-07.png?resize=768%2C324 768w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-07.png?resize=1024%2C431 1024w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/a><\/p>\n<p>Zooming out and rearranging a bit, and now we have a much neater, easier-to-understand node network:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-08.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-116\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-08.png?resize=598%2C295\" alt=\"basic-wood-05-08\" width=\"598\" height=\"295\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-08.png?w=1451 1451w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-08.png?resize=300%2C148 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-08.png?resize=768%2C380 768w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-08.png?resize=1024%2C506 1024w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/05\/basic-wood-05-08.png?w=1280 1280w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/a><\/p>\n<p>You can, of course, arrange your own networks however you choose. Perhaps my choice of organization doesn&#8217;t make sense to you. I&#8217;m also just showing some basics&#8230;there are other things you can do with Node Groups and Rerouting and Input values, but for now this has been enough of a diversion! I&#8217;m sure you want to get back to the fun part of the shader, so thanks for bearing with me for a few minutes. See you next time!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It occurred to me that as our shader gets more complicated, we haven&#8217;t really been doing anything to make it neater. I&#8217;d like to take a few moments to clean it up a bit before we go any farther. As you make your own shaders this is a good habit, especially if you want to&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"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],"class_list":["post-109","post","type-post","status-publish","format-standard","hentry","category-tutorials","tag-blender","tag-cycles","tag-shader","tag-tutorial"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paMavh-1L","_links":{"self":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/109","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=109"}],"version-history":[{"count":1,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/109\/revisions"}],"predecessor-version":[{"id":639,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/109\/revisions\/639"}],"wp:attachment":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/media?parent=109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/categories?post=109"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/tags?post=109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}