Radial Arrays - Getting started with Blender Nodes Part 3

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to another procedural texturing tutorial in this one we're gonna be creating a ratio right now it allows us to your position as many things as we would like around in a circle well we have control of the number of sectors radius we also have control of the rotation of our shapes we have this fade that allows us to blend in between or have a completely hard edge in the case of using a random ALPA here we also have a random size and rotation perception where we have a control of the randomness we also have a random seed and in that case we can use the fade to really blend between our shapes so I think this one's gonna be really useful for you in the long run and I hope you enjoy hope you learned something let's get stuck in we're gonna be using blender 2.82 and we're gonna be making sure because we're working with nodes there are no add-ons we have the node Wrangler add-on enabled I have my procedural texturing setup here which is has a node space nice 3d viewport on the side to make it new material and we're gonna be starting up with our object coordinates ctrl H to hide a shift tab to snap the outcome that we're after is to have some shape potentially a square or a triangle and we would like to array that in a circle there we can have squares or triangles or whatever it is and we would like to be able to input the number so in this case we would have 8 to give us this many well we could also say 6 or 5 or 3 or 30 and they would give us that many of our objects arrayed in a circle and the most common way that people do this is with something called polar coordinates and the way the polar coordinates work is you have a crosshair and you have some distance away from the middle and you also have some distance around the way the people set this up in blender is take your objective coordinates add a texture gradient texture and set this to radial now that we have zero to one going around in a circle like that we're then going to take a convert back to map said this to link and this is gonna give us zero to one going out so now if we take a converter combine XY sides this will be our Y this will be our X we now have a UV space now I'm going to append the shape group that we made in the first lesson shift a group shapes if we have a look at what this does with a zero zero point in the center we can have a shape all off and size joining our coordinates do not have a zero zero point so for us to be able to put some number of zero zero point on this we need to move zero in the Y direction to 0.5 and we also need instead of it just being zero here we need that to be some number so I'm gonna arbitrarily say that they were gonna be five of our site so we need it to be at this point yeah yeah yeah we're here if we have a look at this we have five discreet zero zero points let's put this into our shapes even though our points there are five them and if we take our UV coordinates we can see that we're drawing a circle here so what's going on why is this a strange shape and is there anything that we can do to change it well we can put a little multiplier on the y coordinate soon now we can have some adjustment but we still not gonna be able to make a proper circle we can move this in or out but as it gets too close to the center it sort of it gets sucked in this is easier to illustrate what's going on with our squares you could say the issue is that we are bending our coordinates around the pole around the center and this is the key problem with using polar coordinates rather than having an under form DV on the inch of these points we are having one which follows this circle what we're gonna be doing today is we're going to be working out a way to generate five or seven or thirty discrete UV spaces and have them totally procedural so that we can have an input value and it'll react to that what we're gonna do today is we're gonna be generating vectors for each sector so when I say a sector I mean the section of this circle this is called a sector so what we're gonna do we want to have our plane and we're gonna take from our center point we would like that to be sections on each one of these sections once to have a totally under formed UV space in it so for our solution we're going to be taking our object coordinate and we're going to be translating them from our zero zero point out into each one of our sectors no you need to know where each one of these sectors starts and finishes we need to work out this angle to the centre of each sector and then from that we can work out the X translation and a white translation sounds fairly complex but it's actually really simple for us to do so take out a text record now we're gonna add a texture gradient texture we're gonna sell it to radium so now we have zero to one going around what we need is to be able to set this upper value so that we can go from zero to whatever value we want before we used five so this time I'm gonna use five again do so that we can keep an eye on what's going on I'm gonna add an input value and I'm gonna press it and change the label to sacked account to change this to 5 now if you want to slide there you'll notice it's changing in 0.1 so if I press shift it will change in that 0.01 if I press control it will snap to whole integers I'm gonna bring up to 5 at the moment we have our 0 to 1 we don't need to work with back to math in this instance because we're only using a single line of information just black and white we're gonna go multiply by 5 now what this has done is we have changed our maximum value here so we're going 0 to 5 add math change this to snap at the moment it's snapping at 0.5 I'm gonna change that to 1 so that we are slapping in whole sections now what we have here is an index the list of the space is that we're looking at so we have space 0 1 2 3 & 4 we don't want to work out the value to 0 we need to work out the value to halfway through this which is gonna be 0.5 and then halfway along this one is gonna be 1.5 2.5 3.5 45 so we're gonna take our snap value and we're gonna add 0.5 and then drop this onto the noodle so now what we have is the half way index for us to turn this into an angle rather than just a number we need to work out what the angle per Secretary's and then multiply it by the value that we have here we're trying to get to the halfway point of sector 0 so we're going 1/5 of 2 pi multiplied by 0.5 1/5 of 2 pi x 1.5 2.5 3.5 and so on needs to be responsive to our sect account because if we had seven sectors or 30 sectors it would have to be one thirtieth of 2 pi or 1/7 of 2 pi so we're gonna take our sector count here and we're gonna take and that's now you're gonna just duplicate this notice they get 1/5 of 2 pi we can put two multiply in type i in the top socket we can take our sect accountant plug that into the bottom socket and now what we have your angle this is outputting total angle per sector we just need to multiply this by the value that we have per sector from this at duplicate another math node so it's multiply and put the divide into that to go from having an angle per sector to having X&Y translation vectors we need to have think about how we use trigonometry let's start off with a section so here is our angle theta here is our center point they were trying to get into when we were working with vectors in Landa the way that sine and cokes I will output vector these all been normalized vector so it will have a hypotenuse length this length here will equal a value of one the way that we remember the trigonometry is so yeah we are going to be looking at the opposite and hypotenuse new adjacent and the hypotenuse this refers to the side which is opposite the angle or adjacent to the angle we have a right angle triangle here we have an angle beta which we've just worked out so this is the angle to the halfway of each sector and we need to work out what the X and the y translation is going to be so we can use cosine which is going to be cos theta is equal to adjacent over hypotenuse we use a normalized vector so hypotenuse is going to equal one there we can actually cancel that out and just say that as equal to the adjacent in this instant and we want to work out with the adjacent is so that we can take cosine of theta it's going to equal the adjacent in this case X and equally we can say that sine of theta is going to equal the opposite which in this case it's gonna be Y so let's take our angle we're gonna duplicate our math note again first of all we want to get the X X is the adjacent so we're gonna take cause then we're gonna take another one control shift D because we want the input noodle I'm gonna change this to sign if you have a look at this and this you can see that we're getting some different areas shift a converter combined gonna drop this on here sine goes into Y cosine goes into ax these are our translation factors if I just take an ad in this case we're using a vector output so we're going to be using shift a converter vector math can take how about object coordinates we're gonna add them to our combined vector here now at the moment all of our vectors equal 1 so that's why we're not seeing something here because one is just outside though we do see them in these other spaces so I'm gonna change the scale of our vectors here couldn't take another factor math note here drop it onto that new don't change it to scale and now you can see that we can change the radius changing the radius is another thing that we're gonna have as a value that we can keep an eye on so I'm going to chase us from two radius and I'm just gonna drop that radius value in 12 scale note here and let's bring that down 0.5 just so that we can see it so now if we were to take our shapes now you can see the difference between polar coordinates which are bending around a pole and our undistorted vectors so we've created as we increase this value the maximum of our gradient to J increases because of this multiply we're snapping them interceptions we are calculating the angle to half way and we are using that angle to calculate the translation vector and then we are just changing the scale of that and adding it to our original texture coordinates just to make this whole setup more usable and adding a whole lot of function and I think I want to do something the polar coordinates does automatically which looks quite nice is that you get this sort of out from the center look the orientation of the shapes is all pointing towards the middle you can really see with the hearts they all point towards the center here where is we have a look at ours they're all just pointing up and down I also want to have a play with randomness well we had a look at last time with adding white noise the first thing I want to have a look at is how we can change our scale because as we increase the sector count you can see that these just end up overlapping when we have two of them is totally fine but as we increase you can see this tiny clip off the edge of our sectors I would like to have some relationship between the scale of our shake and the sector count after this add I'm gonna take this scale I'm gonna duplicate it put it on top here now as we increase the size of this you can see that that is decreasing the size of our shapes if we would take our sacked accountant and we just plug this straight to the scale yeah it gets way way way too small I don't want it to be the full amount of this act account I want it to be some modification of that so I'm going to take a bit of math node to fit onto that needle and divide this by 4 so now as we drop the number of sectors that we have and you can see that the arts are now getting smaller so it's a little bit more responsive the next thing I want to do is I want to have a look at how we can rotate these so I'm gonna take a vector mapping node last time what we did is we switch this over to texture texture basically inverts all of these scale location rotation from point so point you can think of it as affecting the UV points beneath and texture works generally slightly more logically for example we can translate the texture in a positive or negative direction and it also works like more logically with scale where we have an increase or a decrease of the scale of our texture however we have a look at rotation whether you're rotating the points beneath or rotating the texture you want it to be rotating clockwise or counterclockwise however because all of these are inverted with the texture temper as we increase the text here mean see it's rotating anti-clockwise which I don't want this to do we're gonna leave this on point because we're not using location of scale this is in Duke on the mapping note but when we take by next versed and plug that in suddenly this is in radians control H we are looking at just rotating at the moment I'm gonna take another value here this one is going to be called rotation de Servian get tabs now I want to be working in degrees I'm gonna add a converter a math node and I'm gonna say to you radians so now I can put degrees in here this will convert it to radians which will put it into this combined XYZ I'm just gonna slot that underneath there and minimize it H you're pressing this arrow will minimize I'm gonna rename this mapping node to coordinates and I want to make a new mapping node which is gonna give us orientated coordinate so I'm gonna take our coordinates and our combined XY set and I'm gonna cook control shift D this is giving us is currently the same output this one I'm gonna rename from coordinates to orientate it you know that for us to do this we need to change our rotation according to the angle per sector I'm going to take off this manual rotation at the moment if we just take our angle per sector which we have here in this multiply and we plug this into our Zed here they forget this is already in radians and so we look at our hearts you'll see that they all look a little bit strange this is because this value needs to be inverted so I'm gonna take this multiplier drop it down onto this node and I'm gonna multiply it by minus one now you can see it's sort of following each other around I would like to be able to affect this with my rotation here so I'm gonna get a multiply here I'm gonna chase this two hat I'm gonna take our two radians output and I'm gonna flip lane so now you can see we can rotate this and they're all orientate it away from more towards the center this last one that I want to generate is gonna be a random one rename that to random we're gonna take a random value per sector and for us to do this we're gonna have a look at that was snapping here this is giving us a single value per sector and we're going to take a texture white noise from us snap into here I'm gonna change from 3d to 40 this is gonna allow us to have a random seed to generate random values per sector I want this to you randomly change the rotation so at the moment we have values between 0 and 1 we need values between 0 and 2pi so I'm gonna take another multiply duplicate this drop it on multiplied by 2 times I and now we have values between 0 and 2pi if we put this into our zero rotation on this random output that's going home look at our hearts take this back to and drop it into here now what we've got is a random rotation per sector on over note here we're going to do control H and we're gonna change the scale because we're not controlling the rotation in this instance I can change this to texture so now when we change the scale up the size increases and down size decreases this is important because when we in to placate our next white noise texture so we have one for rotation we're gonna give seed Sarah we're gonna have one for scale which we're gonna give seat one so that we have different seaport transformation this value is between zero and one so if we left this on point and we plug our scale into the scale here let's have a look at our hearts some of them get really big but change this to you texture and some of them get really small and that's much more what I want we don't want this to get too big for their sectors I'm gonna want to put in a mix RGB so that I can have a control on the amount of the random transformation color mix RGB we want our rotation this bottom one to be between zero and our random amount so mix goes into slot two slot one is solar and this now goes into our rotation so now if we increase or decrease our factor you see we go from zero rotation to your random rotation for our scale we're gonna do the same thing we're gonna put this in color too but in this case we're gonna go out to a scale of one so now there is either full-size or some amount of that randomness a little tip if you want to have these actors joined rather than using a value which you could totally do you could totally plug this into both of your factors and you could have this increase so you can see that this increases to any number we only want to be sliding between zero and one instead of doing that what I'm gonna do is I'm gonna add a color invert this other factor on it so I'm gonna use this as our factor yeah okay now you have a factor that you can control both of these with I also wanna have a random color per sector this is just gonna be an output so that we can use it outside the node I'm gonna add an additional one noise texture control shift D change this one seat to and I'm gonna be adding a color hue saturation can you change the color in here to be a hundred percent saturated and a hundred percent value so now as we add some white noise value to the hue we all be getting a transformation around between zero and one so around the color wheel this is our random color we have a random rotation and scale normal coordinate and didn't orientate it coordinate I would like to add one more feature and this is a fade or tween sections at the moment we have this really hard edge and I don't want to have that I want to have it of blending in order for us to do this we need to think about where we are in putting our change here and it's actually way back here it's just after this gradient that we are going to be adding something and that something is going to be a noise thanks juror so we're gonna go shift a texture noise we're gonna be adding a color mix RGB and we're gonna take our gradient texture we're gonna go into the first one and now this is our new value in here we're going to be taking our noise texture which you can see here detail is the biggest thing that messes up computation time so turn that to zero and he's gonna speed up a little bit we're gonna take our factor we're gonna put that into the second socket about mix note here I'm gonna change from mix to the linear light so we're not mixing between them but we are affecting our radial gradient by our noise texture let's just have a think about how this is affecting so let's go to our snap as we increase this you can see that it is basically bending the edge and the reason it's doing that is because you have some addition and subtraction across the whole thing and then when it is snapping you get AB slight variation in where the snap is happening now instead of this being set to 5 because we want this to be very very fine diffused kind of fade we're gonna sell this to 5,000 now if you zoom way way way and you can still see that this house the noise texture go from a sort of normal working distance it's not really gonna show up if I'd was to change this to 50,000 13 sees now if you're really changing much how it looks in the viewport we're going to cycles you can see so there's also a slightly but you still get that dotting though so now you can see that we've got this linear line affecting a blur here and as we just increase that slightly we're getting that motion now the reason that we use linear light rather than for example add if we have look at what this does this will rotate our sections so means linear light these sectors do not change position they just lose their edge slightly now what does this mean for our shapes well as soon as we start adding a little bit of that blur you can see that we get a little bit of softness but it also means that rather than having a hard clip you can sort of get back some of that edge you can obviously go way too far and the whole thing on just becomes a mess what we need to do is we need to put this into a group node I'm gonna select everything ctrl G tab out I'm gonna rename this radial array I like to have texture coordinates on the outside just because if you have to a coordinates on the outside then this can become part of a bigger system so that is gonna be my first thing to add go shift right click to add this review and this is because I want to go with my group input straight to that I'm gonna change the native vector delete our texture coordinate here then I can put our vector into the vector of our group node I'm also going to start generating some outputs so we have coordinates orientated random and we've also got a random color so now if we have a look at the outsider we have a coordinate less section an orientated ordinate per section a random coordinate per section and we also have a random color per section so if I take orientated and then plug it into my shapes and then I maybe want to add the random color you take a color mix RGB and plug hearts into the factor the first socket is going to be our color and the second socket it's going to be our background color let's take the random color - the first socket then we're gonna put the background to be black let's have a look at creating our of inputs shift right click across here to uncie's up together and I'm gonna go for my transparent socket to this one I'm gonna set a default value to 5 minimum value to be 1 I'm gonna change the input to Sackett account I mean to your shift right click on my radius connect it up rather than just having a sliding scale for rotation I'm gonna have it on one of these factor sliders for a very transparent socket and I'm just gonna plug this into you the factor of my linear light here I'm gonna cut a control right click to bring up the scalpel there so now what I've got is I've got a factor I can change this fact his name to rotation and I'm gonna go from 0 to 360 do a shift right click that will create the riri gonna grab the rotation I'm just gonna put it into that reroute and now on the outside you can see that we've got nice little slide there rotates between 0 and 360 degrees we have a few more things so you want to add we have here a slider for our random amount new socket is going to go into this factor 2 X to delete those and then take this factor input up to this mix shift right click great the review dragging onto that one as well so now what we've got is a factor input I'm gonna rename to randomness we want to add a seed and a fade on the big things about our randomness is that it is controlled by a seed so I'm gonna go into here and I'm gonna create a they'll give us a different seat white noise texture so again transparent socket goes to my first white noise yeah we name to you seed now I'm just gonna plug this into you all of them but each time I'm gonna covert math add one to the different randomness remains different the last thing we want to do is we want to implement how will their let's add a factor again give us a slide I'm gonna rename this to fade and I'm gonna add a multiply gonna drop it onto the correct noodle here the one that glows when you hover over and I'm gonna divide by three so now our maximum fade is only going to be one third kind of want to fade to be up above this randomness stuff so I'm gonna drop it up to just with that up button there so that's all set up now this whole thing there's been a useful video and you've learned something this I think is quite a useful node for understanding how we can intentionally generate translation vectors whereas previously we've used just a random number to transform our Berlin textures but in this instance we wanted to do a very specific task and we were able to use maths in order to generate those factors so that we have it that's all from me today I've this has been interesting and you've learned something let me know what you think down below and I'll be back next week with another tutorial so thanks for tuning in I hope you've enjoyed it I'll catch you next time
Info
Channel: Erindale
Views: 7,720
Rating: undefined out of 5
Keywords: Procedural, parametric, b3d, blender3d
Id: TsivpRAxvLg
Channel Id: undefined
Length: 20min 58sec (1258 seconds)
Published: Wed Apr 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.