Randomness and Tiling - Getting started with Blender Nodes Part 2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Well made and informative tutorial again, these should be more popular.

👍︎︎ 2 👤︎︎ u/Baldric 📅︎︎ Apr 22 2020 🗫︎ replies
Captions
welcome to another procedural texturing tutorial in this one we will be building on the groups that we made last time the shapes group that allowed us to your output circles squares triangles and hearts this time we will be bringing it together with this shape of the tiles group node that allows us to work in an infinite amount of tiles it will randomly distribute our shapes and it will also allow us to control random color rotation and scale change the shapes color the color of the grout and the color of the background controlling the size of our shapes thickness of the grout we also have a random seed on the outside a lot of what we're talking about today is super transfer but we're talking about tiling we're talking about randomness all very important things for procedural textures and just manipulating textures in general so I hope you learned something I hope you enjoy it let's get stuck in - you get started I am working in blender 2.8 - and we're gonna make sure that one node Wrangler add-on is enabled I have a workspace here setup I like to have a material shader editor on my right hand side and just so I can see my output I have a 3d viewport so create any new material we're gonna be working with our Dexter Gordon node everything once again is based on our texture coordinates can be working with objects coordinates shift tab turns on snapping to grid and just then to remove the unused no sockets I was ctrl H the first thing I'm gonna want to sort out is how we do our grid lines now in order to scale up our space I can do it one of two ways we can use a vector math node here and we can set this to be multiply and we can increase the size of all of these a quicker way rather than typing in the number and clicking on the next one I'm pressing taptic is the next one we can select them all together and click and drag that's one way the great thing about doing it this way this will keep differences so let's say you have three different numbers and you want them to move or maintaining the same difference you can do that if you would like to just select them all then that make them the same or select them all and type in a number and it will type the number into all of those now rather than using the multiply node I'm actually going to be using scale scale does the same thing and change our scale to 3 so now we have negative 3 two one zero and then positive one two and three in both axes remember this is happening no vector math node so it's affecting all of the axes together the next thing we're going to do is we can duplicate our vector math node to drop it on again and we're gonna change this from scale to fraction and this has given us just a simple 1x1 square with values 0 to 1 on each axes now a lot of people preference modulo AVA fraction so let's have a look about 1 if I change your disease to be 1 you'll notice that in the positive space we have the same as the fraction node over in the negative space modulo node is not showing anything it's not because there's nothing there it's just because those bunnies of below zero fraction is flawed division which means that it is always working away from negative infinity and modulo is truncated division which means it's working away from zero now the benefit of using modulo you can increase the point at which modulo modulates and that is not something that you can do with fraction fraction is always modulating that one 0 to 1 because it's computationally cheaper I'm gonna use fraction now what I'm gonna do is I'm going to add a converter separating X Y Z and I'm gonna add a maths node service to be greater than greater than provides a binary output based around your second value so the input compared against the second value is this greater than this second value yes will result in an output of 1 no result in an output of 0 this is just a boolean operation and when you have a simple or linear gradient like this greater than where it's quite predictably gonna duplicate this I'm gonna put this one to the y axis so that we have both of these here I'm making a duplicate yes third time but I'm gonna send it to you multiply then I'm just gonna drop that into that note together we have different controls for our X and our Y I'd like the same control gonna add an input value I can just plug into the Bossip if both so now I have a single value you're going into both of those and that'll do that now you might notice that our tiles are shrinking than they are only shrinking one direction this not how we want these to bathe we want all of our tiles to be shrinking symmetrically so in order to do that rather than having it go from 0 to 1 0 to 1 we wanted to go from 0 to 1 to 0 0 to 1 to 0 so our gradients become so much call across each of our tiles here we're gonna add a color ramp click the plus button on here that had a third like this position default to halfway between the two flags set the value of this to one gonna set the final flag value to zero and now if I plug the X into this you can see it has been remapped to be zero one zero one zero take this into our greater than note you can duplicate this I'm gonna drop this onto the y-axis as well now if we have looked I'm multiplying when we change this all of our lines expanding and tracked symmetrically I'm gonna select everything control J and I'm gonna rename this ground and the last lesson we made a group node that created two shapes circles squares triangles and hearts I want to use that for this material but if I go shift a and look at my groups I've got it what I need to do is I need to append it I'm gonna go file appender so when you append something you're gonna need to look inside a blend file if you navigate to where you saved your shapes inside that file you'll be able to see that we have a whole into different folders what we're looking for is no tree in here we can see that we've got one called shapes we add that nothing's happened but when we go shift a group we can now see those shapes is in here so taking object coordinates into the vector we have a size and we have a fall-off adjustment we have circles squares triangles and hearts our input needs to have a zero zero point all of our shapes are designed to sit on that zero zero point so with object coordinates that's fine it's in the middle I thought we want each one of our tiles to have those axes so that we can put a circle in each one using those that we've already got we've already increased this scale by three times and we've got it through a fraction node we should split this into individual UV spaces we want zero zero to be at the center of each space if we just take this and we plug the vector output into the vector input of our shapes group you can see that all of our shapes to sit on the corner we would like to move this up so that we have not 0.5 in the middle for just 0 if we take the mapping node and we plug it in here you can see that if we change the location and we changed the location to minus and our object is going in a positive direction this is because we are affecting the UV space that is controlled by this type point we are going to change time to texture now if you move the location positive values result in a positive translation of our texture not the UV points for the texture so if we set this to zero point five zero five I'm just gonna reduce the size we do not want to move the Z value because we are working with length in our shapes yeah our circle is using length and our hearts are using length we do not want to be affecting this side value because it's essentially moving our sphere our length vertically and we are texturing a plane so we are taking our shape out of dimension that we are able to work with think about our plane looks like this and we have a sphere so as this moves up or down we get different sizes as it comes in or out so we can leave that as zero that's quite important a lot of the material that we're making is looking at how we can bring randomness into our materials so to do this we need a random value for every single tile to you get randomness with all of the tiles is actually really simple to do with blender rather than using our fraction here I'm just gonna do ctrl shift D to duplicate with our invert noodle here I'm gonna chase us from fraction to snap I'm gonna change the snap value to one we won't have a snap tiles to be the same size what snap has just done is is now every value to the integer below where we have a graph where the value over at so that's our scale input look Frank this is a value here of three which is what we have here when we snap it or we actually then get as soon as it reaches three it would become three but we don't see any of that I'm not going to beyond it so we can say yeah the value is greater than or equal to the value where it is also less than the value plus one zero until it reaches 1 it is 0 that's why we use snap because we get a continuous value per tile we need to convert that continuous value into a random value and to do that we can either use the noise texture or we can use the white noise texture if I put these onto our unsnapped coordinates and you can see that our noise texture this is sarandon but it's sort of regions of random where is the white noise texture you almost can't see it but it's every pixel why it doesn't change when you zoom in or zoom out it's only at a pixel level because it's controlled by the input vector so every change in imperfecta results in a different value being produced with scale this finally changes at every single pixel but once we've snapped it and we're getting single vector herself and then when we put that through the white noise texture we get these fixed eyes look we're gonna change from three days to fourteen because I want this ee w is gonna give us a seat from you that allows us to change the random distribution and then once you've done that we can start looking at how we can integrate this into our shapes so to start with let's have a look at how it can change scale so as we change the seed we randomly change the scaling so where we have a lower value then size of our shape becomes considerably smaller where the value is closer to one scale is closer to one and therefore the shape remains similar size to what it was before I want this to be variable I want to be able to say yes random scale no random scale and I want that to be on a sliding scale so what I'm gonna do is I'm going to say color mix RGB now what we have is we have a mix and the default value here is not one if I set up to be white then we all have standard scale or some amount of that randomness at the moment we have the zero resulting in lots of randomness one resulting in no randomness and I actually want the opposite effect so now what we have is no randomness and yes randomness it's a great that's our random scaling the next one I'm gonna do is random rotation don't fail to rotate a said axis what we can see on here is that we have a value in degrees we only want to be able to affect the said we need something that all let us use a single stream of information convert combine X Y Zed vector into rotation now we can put something into this set what I just said about this being in degrees if I use a combined XY said this is now actually in radians so that's something that you really need to be aware of is that generally speaking unless it states otherwise you're working in radians we can plug this white noise into you how I said to you and I'm just gonna do ctrl H now we have a random rotation I'm just gonna duplicate our mix hang and drop that on I'm gonna put this into the second socket and now rather than going from one which gives us this a slight offset so we're going to set that to being black so if there is no rotation when we increase the rotation you can see that they all rotate counterclockwise and maximum rotation is only I see very slight it's not going that far at all notice because we're having funny range of 0 to 1 or as a full circle as a range of 2pi we never want to multiply our output by 2 times pi so now you can see that we get a full 360 degrees of variation however all of our shapes are also going counterclockwise I would like them to be rotating clockwise as well it's going to clockwise so rather than it going from a range of 0 to 2 pi I would like it to go from negative pi to positive pi to do this we just need to subtract PI 2 ways to do this I can either duplicate the maths nodes at this to subtract and put PI in this input now we can see that we're getting opposing rotation which is great nice what we want however there is a quicker way to do this rather than using the subtract here I'm getting changes from multiply to multiply and I'm gonna set this value to minus pi so now we are multiplying by 2 pi subtracting PI on the single node than this doing exactly what we wanted to so now what we have is random rotation random scaling and we have controls for both one of the big reasons that we're using 4d noise which has the access to the seed because it will allow us to make sure that we're not using the same seed value for different transformations at the moment things that rotate a lot also the largest and things that rotate a lot in a clockwise direction are the smallest even though we're working with randomness or we have is a person so to change this I'm gonna duplicate our white noise node and I'm just gonna use that one instead for our rotation and now I need to make sure is that instead of having the same seed value I have a different seed valley any value is fine to su 0 than 1 so now we have different randomness between the two different transforms in order for us to do the next part which is randomly distributing our four shapes across the tiles we need to make something called a gate to make our gay we need to have a system that will allow us to have four inputs and one output and distribute those four inputs according to some seed value some random input so you can see where this is going we're gonna get another white noise note I'm gonna change the seed of this one to two just so that we have different value and we are gonna just be using mixed notes in order to distribute our four shapes according to the rules set out by our noise texture I'm going to duplicate our mix here and you will notice that we have a factor this factor will allow us to flip between zero and one so if we have four sockets then we need to be able to switch between zero and one on each of them but we also need to connect them so I'm gonna have to use another mix now to you now we need mix one here to go from zero to one we then need to mix three here to go from zero to 1 and then we need this one to go from zero to one if you have a larger system with six inputs for example then you would need to have another info here that would go 0 to 1 0 to 1 0 to 1 0 to 1 0 to 1 so that's your order you can add branches and that branches no branches we next need to have a range of numbers from 0 to 1 1 to 2 and 2 3 no way for us to do that and we've only got zero to 1 if you remember what we did with snapping when we have a scale of 4 then we have 0 1 2 3 and so we're gonna take our noise texture we're gonna add a convert a math node x for reeling in and add another maths node after that and we're going to change this to snap and change the slapping value to be 1 so now we have values of 0 1 2 3 now if we just plug this straight into our mix here what we've got is some values which is 0 and other values which are 1 2 & 3 they will just show off as 1 we then need to mix the second one with all of the values which are 2 & 3 so we're adding 2 & 3 here so to do this we branch off from this snap node and we subtract 1 so what this is done is we always need a 0 to 1 so to get the relevant 0 to 1 I have just shifted this down I'm then going to do the same again then I'm gonna change this to 2 so this time we just do down two steps and I'm just putting that now I'm just gonna group this together and I'm gonna call that Kate I'm gonna be using color inputs and I'm also gonna be using a color output there is also interview a seed input which is just a single line of informations we have this value of birth I'm going to rename that to seed and then gonna connect our four different color inputs here I'm gonna rename this one two three and four there are output I'm just gonna rename that to out but they're great we have our seed that goes into our seed value and now if we plug in our circles or squares our triangles and our hearts now we have randomly distributed our shapes they are all connected to the size and falleth and if we change our CW then it will change distribution of those shapes all of the scaling still affects all of them and all of the rotation still affects all of them the final thing that I want to be able to do to these shapes is I want to be able to distribute colors across them at random I'm going to duplicate our final Y noise here and do control shift dates and it brings the noodle and I'm gonna change the seed to be 3 just so we have another different seed I'm going to add in color hue/saturation now for us to be able to randomly assign colors we need to have a base collector you can see here and if we move the hue we can shift it up to 1 or down to 0 starting at point 5 we have values from 0 to 1 what we can do now is if we plug this onto our queue you can see that we get a change in here we have lots more than 4 colors you know the for us to snap this to be 4 we can go converts mathis snap and relevant point 5 engines at 0.25 this will give us 4 sections which is snapping - the great thing about this hue saturation value is we already have from a factor right on the node so we don't need to do anything like we did before with the mix what we can do now so you join everything together is we can add a mix RGB we have an indexed list with mix RGB so if I plug the output our shape output into our factor then we have a background color which is in 2 and we have a foreground color or a shape color which is in 1 this is because we have black shapes index 0 we have white background index 1 now we can take our color put that onto our shapes we have very control for the background color and we have our input control the shapes and the factor on the randomness following that we need another mix RGB this we are going to add in our original grout grid and we're going to use this as a factor in this case we have like lines and we have white tiles so when that goes on to the mix know do you have a lines being the first option and we have our tile coloring the second option which we can take from the previous mix let's make a couple of little tweaks to our shapes one because as you can see this British heart this rotated triangle these are not centered so we can just affect very easily we can add it converter vector math and I'm gonna draw the y-value a little bit just to move it up slightly zero point zero seven and I'm gonna do the same for the heart in this case to a positive value point one don't want to go too far that's made that a slight adjustment final thing for us to do we're going to turn this into a group select over then ctrl G and we'll bring up our information panel now I want several outputs we have our current output this I'm just gonna rename two tiles complete and then also want my shapes this is how they you come in but because that black and white I don't really want that to be a yellow output so I'm gonna delete that I'm gonna take any gray output and it touch it and then gonna replace that with the one that we want rename this shapes I'm also going to add the grew out output and lastly I'm gonna add just one of the random values when the outside of our node we have tiles complete which gives us a tower full tile we have our shapes which gives us our black and white mask about grout which gives us our grout mask and we have a random value per cell who's gonna rename this node group to be shaped tiles now we need to think about our inputs I like to have my coordinates on the outside control H tied we need to make an input and our group input I'm just gonna drop that across coordinates and I'm just gonna go through this node tree and I'm gonna add where I want to be a controllable input from the outside if I just connect this object into here that'll bring us back and I can delete this I'm gonna connect this scale here and I'm gonna rename this to tiling I'm gonna add size I'm gonna add fall-off just like how we did before I'm gonna change the ET val value to 0.5 and the fall-off 0.95 the next one of our inputs we're gonna do is our background color what we can see on here is this sort of peachy color which we can find here on this mix node I'm just gonna connect that up and if we look at this much to make it whiter and desaturate it leave it as an actual white rename to background color the next input art is we're out to color which is this pink here I know color input is our main shape color then I'm gonna have the sliders for the randomness connect the next one to the factor the hue/saturation value color Rand and after that's gonna be scale randomness like this to the factor of our scale R and this next one will be our factor of the rotation Rand and then our last two are gonna be our group thickness which was this value up here and instead of connecting to both of these I'm gonna go shift right click and drag across this kind okay reroute is going to delete this value I know that the greater than wants to be a sliding scale between 0 and 1 we can get the slide from a factor so I'm just gonna take this transference okay I'm gonna plug into any factor that I can find and they're gonna reconnect my rotation randomness to that it's ok so now what I've got is a power sliding factor and I'm gonna call this one Corral sickness I'm also going to reduce the default value to 0.1 graphicness can now connect that reroute and here we go so now I've got very slight the crowd thickness may even make more sense to put the graphic nice I erupted in between the tiling and the size we wanted to move our thickness we can't click and drag but we can make sure it is selected and then press the UP button until it is in the position that we want it to be finally we want to have a control for our seeds just so that we can change them rather than just plugging straight in this w which I'm gonna rename as C eat other than just this into all of them which will result in the same distribution so all my squares are pink all my triangles are oranges all my hearts are green my circles of belief not really what I was wanting it to be but that's why it's important that we use different seed values very easy for us to do that though the first one is fine we were gonna add a converter and math now just add one two three now our seed values are all different so now we've made our second group node it should show up on our list here we also still have access to our gate now I'll show you a little extra tip for the gate and momentarily so I know that the material that we've made today is less realistic it's not about creating red bricks or creating roofing tiles or things like that it's important to get the understanding of manipulating UV coordinates to do your bidding I hope it's been informative and I hope you've enjoyed it and learned something and I hope you'll join me next time as well where we are gonna be looking at something slightly more advanced just one step above before we get into doing real materials just to get our foundations down with procedural text yes okay thanks Jeannie Ihnen I hope you've enjoyed and I will catch you next time so except that I will show you a little something that you can do with the gate working in cycles allows you to use a function on the geometry node called random / Island so I have two arrays on this one plane and random / Island lets you set a random value pair geometry Island there is an object random this works with cycles and with Eevee but it will only work on disconnected objects so it does not work with arrays so random / Island I've got four different plywood textures these are photo texts yesterday my higher quality but as you can see if every single one looks like this it's got a very clear pattern let's take a roundabout Island which is a random value between 0 and 1 PAH secure gate you can see what this is going then we can just pass all of our textures through there we go you have randomly distributed your image textures across an array
Info
Channel: Erindale
Views: 12,339
Rating: undefined out of 5
Keywords: b3d, blender, procedural
Id: nm3QRLe846M
Channel Id: undefined
Length: 23min 3sec (1383 seconds)
Published: Wed Apr 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.