{"id":383,"date":"2017-11-11T00:21:08","date_gmt":"2017-11-11T08:21:08","guid":{"rendered":"http:\/\/www.artifisizzler.com\/?p=383"},"modified":"2019-03-11T01:39:54","modified_gmt":"2019-03-11T01:39:54","slug":"ive-finally-hit-the-floor","status":"publish","type":"post","link":"http:\/\/www.decscroll.com\/blog\/2017\/11\/11\/ive-finally-hit-the-floor\/","title":{"rendered":"I&#8217;ve Finally Hit The Floor"},"content":{"rendered":"<p>Ever since I started exploring procedural wood shaders, I&#8217;ve wanted to then use those to make wooden planked floors. As I mentioned in a previous post, a wooden log is cut into boards by slicing it along the long axis of the trunk, moving outwards from the center.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/09\/texcoord-007.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-193\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/09\/texcoord-007.png?resize=490%2C460\" alt=\"\" width=\"490\" height=\"460\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/09\/texcoord-007.png?w=490 490w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2016\/09\/texcoord-007.png?resize=300%2C282 300w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><\/a><\/p>\n<p>There are several ways to cut a log, but basically since I have a nice cylindrical chunk of wood I should be able to make &#8220;boards&#8221; out of it by simply moving the texture coordinates around. So, if I can get a repeated pattern across a flat plane, and move the coordinates in that pattern by random amounts, that&#8217;s a wood floor. Simple!<\/p>\n<p>Well, it has eluded me for some time now.  This post isn&#8217;t a detailed tutorial on creating a wood floor, but it does explain some of the process I went through to get to a shader I was happy with.<\/p>\n<p>Anyway, I noticed that the Brick shader in Blender can give a nice random brick pattern with different colors in the bricks, so I thought, that&#8217;s just what I need! I can set the colors of the shader to black and white, and that will give me various shades of gray and I can use those as the offsets. Let&#8217;s see, a Brick node on a Plane:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor01.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-385\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor01.png?resize=606%2C439\" alt=\"\" width=\"606\" height=\"439\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor01.png?w=606 606w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor01.png?resize=300%2C217 300w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/a><\/p>\n<p>Nailed it:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor02.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-386\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor02.png?resize=640%2C536\" alt=\"\" width=\"640\" height=\"536\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor02.png?w=686 686w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor02.png?resize=300%2C251 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>So if we just add those gray values to the mapping vector of our wood texture, we should be in business. Since those gray values are only in the range 0 to 1, we can probably multiply it by something like 10 to get a bigger range of movement for our wood. Let&#8217;s see what happens if we use the Add node to add the output of the brick node to the Vector coming out of the main Mapping node in our Red Oak shader:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor03.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor03.png?resize=640%2C572\" alt=\"\" width=\"640\" height=\"572\" class=\"aligncenter size-full wp-image-389\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor03.png?w=746 746w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor03.png?resize=300%2C268 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Well, that didn&#8217;t work at all. It&#8217;s hard to even see, but it looks like it&#8217;s still one big piece of wood but with parts of it moved around a little.<\/p>\n<p>It occurred to me that the shader we&#8217;ve been building uses the Object mapping mode, so the texture coordinates are based on the entire object as if it were solid. Since it&#8217;s not UV-mapped across the surface you can&#8217;t really warp it any way you want like you could with UVs.<\/p>\n<p>Perhaps I needed a different mode. In Generated mode, the coordinates are mapped from 0 to 1 across the surface of an object, and you can move them around just like UV coordinates, so in theory, that should give me more flexibility.<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor04.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor04.png?resize=640%2C571\" alt=\"\" width=\"640\" height=\"571\" class=\"aligncenter size-full wp-image-390\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor04.png?w=788 788w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor04.png?resize=300%2C268 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor04.png?resize=768%2C685 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Initial results are pretty similar to before. I think what is needed is to reset the coordinates to &lt;0, 0, 0&gt; for every brick, and THEN add the gray value for an offset. I tried many things but couldn&#8217;t figure out how to get the coordinates to map the way I wanted.<\/p>\n<p>When you are stuck on something Blender-related, a great place to go for help is Blender StackExchange. I found some similar questions but none quite what I wanted, so I posted my own question:<\/p>\n<p><a href=\"https:\/\/blender.stackexchange.com\/questions\/28838\/how-can-i-create-a-staggered-repeating-procedural-pattern\">How can I create a staggered repeating procedural pattern?<\/a>  <\/p>\n<p>This is one of the images from the answer:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/51b7wm.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/51b7wm.jpg?resize=320%2C320\" alt=\"\" width=\"320\" height=\"320\" class=\"aligncenter size-full wp-image-388\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/51b7wm.jpg?w=320 320w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/51b7wm.jpg?resize=150%2C150 150w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/51b7wm.jpg?resize=300%2C300 300w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/a><\/p>\n<p>That looks perfect, if I can just swap out the wood for the colored Voronoi there. <\/p>\n<p>To make a long story a bit shorter, I quickly realized that the problem with this solution was that the pattern repeats perfectly, so while it sort of worked, every single plank looked exactly the same.  I spent a long time struggling with how to manipulate each plank so that it looked differently, when I suddenly hit on a solution:  I needed to combine BOTH my original idea and this new solution.  The brick pattern gave me the different values per plank, and the Blender StackExchange solution gave me the method to reset the coordinates for each plank.  <\/p>\n<p>So here&#8217;s the Blender StackExchange solution with a simple Voronoi pattern:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor05.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor05.png?resize=640%2C526\" alt=\"\" width=\"640\" height=\"526\" class=\"aligncenter size-full wp-image-396\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor05.png?w=741 741w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor05.png?resize=300%2C247 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>I tweaked the settings of a Brick Texture node so that it lined up perfectly with the pattern:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor05b.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor05b.png?resize=640%2C527\" alt=\"\" width=\"640\" height=\"527\" class=\"aligncenter size-full wp-image-397\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor05b.png?w=739 739w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor05b.png?resize=300%2C247 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Then I add the values of the Brick Texture to the Z-vector of the StackExchange node:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor07.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor07.png?resize=640%2C386\" alt=\"\" width=\"640\" height=\"386\" class=\"aligncenter size-full wp-image-399\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor07.png?w=935 935w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor07.png?resize=300%2C181 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor07.png?resize=768%2C463 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>&#8230;and it works!  <\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor06.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor06.png?resize=640%2C529\" alt=\"\" width=\"640\" height=\"529\" class=\"aligncenter size-full wp-image-398\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor06.png?w=737 737w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor06.png?resize=300%2C248 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Plugging in the Red Oak texture with some tweaks, and it&#8217;s actually doing the right thing:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor08.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor08.png?resize=640%2C615\" alt=\"\" width=\"640\" height=\"615\" class=\"aligncenter size-full wp-image-401\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor08.png?w=736 736w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor08.png?resize=300%2C288 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>I did a lot more tweaking of the numbers, and added a bunch of nodes so that I could use slight shader variations based on the values of the Brick Textures, and I got a result I liked:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor09.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor09.png?resize=640%2C607\" alt=\"\" width=\"640\" height=\"607\" class=\"aligncenter size-full wp-image-402\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor09.png?w=741 741w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/floor09.png?resize=300%2C285 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Awesome!  I won&#8217;t post the whole network as it&#8217;s a bit messy, but the full shader is available on BlendSwap <a href=\"https:\/\/www.blendswap.com\/blends\/view\/89805\">here<\/a>.  Feel free to download it and dissect it to see this all in detail.  I&#8217;ll explain how I did the variations of the planks in another post on another day, but in the meantime, here&#8217;s a room I used the shader in:<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/bedroom02.png\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/bedroom02.png?resize=640%2C360\" alt=\"\" width=\"640\" height=\"360\" class=\"aligncenter size-large wp-image-406\" srcset=\"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/bedroom02.png?resize=1024%2C576 1024w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/bedroom02.png?resize=300%2C169 300w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/bedroom02.png?resize=768%2C432 768w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/bedroom02.png?resize=1568%2C882 1568w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/bedroom02.png?w=1920 1920w, https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/bedroom02.png?w=1280 1280w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Happy Blending!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever since I started exploring procedural wood shaders, I&#8217;ve wanted to then use those to make wooden planked floors. As I mentioned in a previous post, a wooden log is cut into boards by slicing it along the long axis of the trunk, moving outwards from the center. There are several ways to cut a&#8230;<\/p>\n","protected":false},"author":2,"featured_media":406,"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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"enabled":false},"version":2}},"categories":[1],"tags":[4,8,14,16],"class_list":["post-383","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-blender","tag-cycles","tag-shaders","tag-wood"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.decscroll.com\/blog\/wp-content\/uploads\/2017\/11\/bedroom02.png?fit=1920%2C1080","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paMavh-6b","_links":{"self":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/383","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=383"}],"version-history":[{"count":1,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/383\/revisions"}],"predecessor-version":[{"id":626,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/posts\/383\/revisions\/626"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/media\/406"}],"wp:attachment":[{"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/media?parent=383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/categories?post=383"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.decscroll.com\/blog\/wp-json\/wp\/v2\/tags?post=383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}