Procedural Flowers with Sverchok - Blender Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this tutorial we are not going to be doing geometry nodes uh but we will still be doing procedural modeling we're going to be using spur truck today which i know uh if you've watched some of my older videos then perhaps you might have seen already a lot of people won't know what this is but we'll be more kind of open to it i think now having experienced geometry nodes in this tutorial today we're going to be looking at phylotaxis so if you've had a look at my splash screen videos or if you have played with my toolkit you've probably come across the filotaxis node in there for geometry nodes and if you have a look inside you'll know that it's just like it's a long line of notes we can make uh the same pattern much more clearly much more how we we're used to doing so with with shaders working with nodes and shaders um so that's what we're going to do today with sverchoff let's jump over to the screen so filotaxis what is it it's the it's most commonly seen in plants and we see it all the time in like flowers arrangement of petals the arrangement of seed heads pine cones um the way that sprouting plants like with a stalk will have leaves coming off the rotation of the leaf per leaf right in this it's to do with how much light they can get to the leaf is supposed to be the optimum amount of like light per leaf so they can photosynthesize as best as possible or with flowers it's just a very dense arrangement so it's good for for seed heads and things like this so in blender if you've seen my drum which knows once you'll know that i have like my 3d viewport geometry nodes and a spreadsheet and when i'm working with surcharge i have it set up a little bit differently and this is because sverjock can be more in parallel which is the common complaint for geometry nodes is that it's too linear and with spur chalk we can actually branch off and do things as as you would think so this is why i have my larger node space for this and i'd recommend if you're setting up this vertchock workspace you would do something similar what we're going to be doing is creating a number of points and the position of these points is going to be offset by uh by two things so each point has to be rotated around in a spiral so a spiral has two things uh you have the the angle as you go around and the main phylum axis is 137.5 degrees but you can change that to be whatever you want so that's the offset per point and then we also want to have a radius offset so if we didn't have a radius offset and you would just go around in a circle but with a radius offset then we can extend outwards basically to give us the spiral so let's create a new node tree here first thing i'm going to do is i'm going to add a vector vector in and if you want these icons on your menus which i really like having and if you just go to edit preferences add-ons go to spurchalk and you can turn on show icons in the shift a menu so that is that is what i'm using there so let's add a vector vector in and if i control shift left click then we can see visualized our point there so this creates like a it's called a temporal viewer which just means that it's not actually real geometry it's an overlay uh but we can use this to just help us visualize things as we work through here so if you haven't worked with spur drop before don't worry we're going to be working through quite slowly here basically we have this vector in and you can see that it is generating a point with these coordinates and what we can do is we can set um we can send in like a range of numbers to create a range of points this is different to geometry knows where everything is like attached to geometry whatever that means in this case we're just reading the vector as a vector so let's take a number number range in here and this is kind of the heavy lifting node this is one that is going to generate all of our points so to begin with let's change this over to step we want a step size of one and then we can control the number that we have the count in in geometry nodes when we take a line node with a one meter offset and then a separate xyz and we take the our like index as the whichever axis have it has the offset by default that'll be the z axis this is just doing that right so if i plug this into my x then you can see that we have a one meter offset per point and it's just generating 10 points or 11 or whatever and i can just change this in here how would we turn this into a circle because we've done circles and if you look at the spirograph video for geometry nodes that's how we make circles it's a little bit easier with geometry nodes sorry with spurchalk because we can just add a scalar math change it from multiply to sine and cos and then then there we go we have a circle um and we can just set the set the number of points on there so this is kind of most of what we have to do the next thing that we need to do is sort out those two offsets that we were talking about so we have our angle per point and we have our our radius per point to begin with let's start with our angle per point now we're going to need a number range in with a one like a step slice of one for doing another part of this for doing the radius so for now let's just keep this how we have it here and we'll multiply it by something we'll multiply it by the angle that we want so at the moment we're getting a if i reduce this to 1 and then we go to two so this angle here in our 3d viewport this angle is one radian right so one r and that angle is about 57 degrees so what we want to do is we want to multiply this one by whatever radian angle is 137.5 we don't need to know this we have in here we can just change this over to radians typing 137.5 like so and now the output of this is going to be in radians you can see 2.4 if i just ctrl shift left click on there it's going to generate a stethoscope which is a like a little text viewer here and you can see the number is 2.4 so the number we want is 2.4 so let's take a multiply in here uh where we multiply and let's just multiply this on there like so so now instead of being that one radian offset we now have this 137.5 degree offset and if i add another point another point and you can see that these just keep going around around the circle great so this is our angle offset let's just pull this out i'm gonna put in a frame called angle we now need to work out our radius offset this again is actually not too challenging um the easiest way for us to do this is to scale our vector right so if i add a vector vector math node here and i change it from a component to multiply scalar then now what we have is a vector being multiplied evenly by our scalar or our float and you can see there that just changes changes the radius so instead of putting in a constant here i would like a different value per point and we could do something even very simple here i could just take my number range directly plug it in and if i zoom out you can see that that is a it is a spiral however we want a little bit more control and there's a specific falloff that looks really good and it gives us an even packing what we need to do is we need to take a zero to one range because at the moment if i set this to one on my scaler then we have a radius here of one which is nice and easy for us to to work with so we want to keep that so i want the maximum number that we multiply by to be one and to do this what i'm going to do is i'm going to create a factor output essentially a 0 to 1 range across all of these points if i just add a fizz sorry a text viewer text mark and i'm going to turn off frame turn on auto update let's bring this up in our viewer here so this is just a regular text editor that we can view the spur chop viewer and we have points as you would expect a one offset with 51 points is going to go from 0 to 50. remember starting at zero so ends one below our account so if i was to take this range and divide it by the total number in the sat 51 then we can have a range of zero to one more or less one anyway so let's add another math node here scalar math i'm going to set this to divide and i need to take my number here as a separate number so let's add a number just a number change this to integer and now i can set this up to 51 which is what we have already and let's also plug this into our divide so now on our viewer we can see that we have this range of numbers up to 0.98 um yeah 0.98 to be more accurate if i was to set this to 50 then it would be perfectly up to one so i should do like a subtract one but it doesn't really matter what we're doing here because when we sort out the radius we're going to do it analytically right we're going to look at the list maximum value so it's not like compulsory that we have it go up to one it would just be like more accurate yeah okay let's do it let's do it the proper way right let's grab another scalar math node subtract one from it there we go conscience is clear so zero to one range properly going in there and if i was to now plug this into my scalar you can see that they the maximum radius hasn't increased all that's happened is the inner ones now scale down to zero in the middle now let's increase the number of points here and you'll see we get more points so let's just reduce the size of our viewer we've got to change the falloff because at the moment they're really dense in the middle if we go back to our preview here what we're aiming for is something that's fairly even however i will acknowledge that real flowers do actually have a size full of depending on the size of the innermost ones right because they grow and then they get like pushed out as they grow so they are increasing in size as they go out back to here what we can do therefore is we can add a power and because we have a zero to one if you do a power like a squared so to the power of itself or sorry to the to the power of two being times itself then where is zero it will stay at zero and where it is one it will stay one because one times one is one so what happens when we do a power on here is we can get a curve either one way or the other which is very useful if we have a zero to one range we can do this quite predictably if we were just using the full range like without doing this divide beforehand then you know a value of 50 times 50 would be 2500 so that would be fast the greater range than the original range of 50 is now going up to two and a half thousand so splitting this down into a zero to one range means that when we do our power it's going to stay within the same range right one is never going to be greater than one but it's just the values in between basically become more or less uh up or down with it with a bit of interesting falloff i'm probably not explaining this very well let's just grab a power by y and here we go if i change my y value up you can see that we pull into the middle and if i change it down you can see we push out from the middle and it feels about right somewhere around here so look so that's 0.54 0.5 is actually what we're after which is the same as a square root so to the power of 0.5 is actually the same as doing a square root operation so you may want to have yours flexible here depending on you know if you wanted to have different size in the middle then perhaps you'd want more densely packed i'm just going to keep mine to a square root and for that i will actually use the square root function already we have basically all of our points in position now another thing which is very useful for us if we are doing flowers is to be able to expand the middle because if we have petals and they want to come out from the outside of the seeds right so they yeah they want to come out from the outside of the seeds they don't want to start in the middle of the circle as well very simply we can just add another math node in between our divide and our square root and if we change this to add there we go then you can see that we can push that out from the middle now this is where we're going to do something that's a little bit more advanced than the geometry node setup what we have already is basically what the geometry knows one can do however we can make it go even further with shot because we have some analytical tools in here so what we want to do is we want to make sure that we are scaling our positions down a little bit so i'm going to bring this one down here ctrl j call this one expand and that gives us our expansion plug that in so you can see that our outermost points get bigger further away so our radius isn't controlled it's we can set our radius to begin with however by the time we've scaled everything or expanded these these points outwards then we are no longer maintaining a radius and that's kind of problematic because you might have something very specific like especially if you're doing an architectural project you may be like this site only has 10 meters and i have to position these things within 10 meters and i also need some some space in the middle so you can't have it set to 10 meters and then expand in the middle and have the outside push out that's not acceptable this is the great thing about sverchok and being able to work in parallel we we can take our values here right and we can find the length of them this is going to tell us what the radius is so i'm just duplicating my vector map here or if you want to grab it again it's under vector back to math so let's grab a length operation and now you can see in our viewer that each one of these values within our list has been the length of it has been calculated so that's very useful we can find out that our final one if i set my expand back to zero our final one is a value of one which is perfect because this is if we if we were to multiply this right by any value then that value that we multiply by becomes our radius however as i expand now we're at 1.4 so what i can do is i can find my length on here and i need to grab my list in geometry nodes we will be getting attribute statistics so this process that i'm doing now will be available in that system so i've just added the list statistics node here and what this does is it basically takes all of the values within your set uh within your list and it does some form of calculation there's a lot of useful things in here very useful things and the one that we are interested in right now is maximum we want to find what the maximum value is and make sure by the way if you're looking at the name here and it just says maximum uh you just want to switch over to value so we can find out that our maximum value here is 1.4142 and i need to find out what you would need to multiply that by to get one so let's take a divide here and if i put my value into the bottom and that now i have a divide number in the top and we can see that value is 0.707 let's make it a bit bigger so take another multiply scale there and if i plug this in here set that back to 1. so now our radius is always going to be whatever value is in that uh in that divide so you can see that doesn't change the outside radius just the maths here i know it can be a little bit confusing like why do we divide it by something and then but the reasoning is right we've got x essentially coming out of our list statistics an unknown value or a known value but changeable and what we do is we divide one by it and then we multiply it by this range here which goes from 0 to x so that ends up with it being like like this right so x and any value which is just a value we can also write as being that value over one right so anything divided by one is just itself um this value here of course could be any any number but the great thing about this is that because we're multiplying we can also cross simplify so these both simplify down to one and there we go so now we have our number that we input to the divide over one just means our value so it's nice easy way for us to just make sure that we're getting the value that we want on here and let's pull this out as like a a controller as well so let's call this one radius and it's a float and we're just going to set this to one to begin with and let's plug this in to the top of our divide division is one of these things which it matters which order you do it in so radius into the top and the list statistics value goes into the bottom cool so this is um this is basically how you make phylotaxis we're going to make an actual flower in just a sec but i just wanted to kind of take a pause here just to show that it's it's not crazy difficult you can do it with just a few notes i really like swerchock it's great i know some people have been asking if i'm going to continue with spur chart content now that john which notes is here and the answer is yes i absolutely will be i've got a few projects planned force verge i've got a course planned for spurjock as well just needs me to sit down record edit script do all of that fun stuff but that should be coming this year that is the plan sometime in autumn so here we go here is our our thing i'm going to show you how to make into a group node because group nodes are reusable you just add them append them or link them as you would any node group um so let's just let's copy these nodes and i'm going to add a group node in here hit new i'm going to paste in these nodes here and we can just do something like this right so you can connect these you can say you know you've got integer values in here making sure that these are sort of expected values let's change this to count if we view this then you can see see what's going on there so it's literally that simple i could just go through here add the angle here so and you can see that we're just working through this is just the same as any node group great thing about these value nodes is that you can plug directly into the back of them um so this one was radius so there's a couple of extra things that may be worth just adding in here um that would be very useful for a group node so one of these things is having the vac value right this zero to one range i want that exposed i also want the number of points to be exposed so now i've got everything in here let's just make this space full size if i i'm in here um our output we have our vertices and let's also grab our count value so that's very useful and our falloff which comes from this divide this one just after the number range divide join that up like that and i'm just going to call this one back for factor this is already looking pretty good we've got our nodes if you are interested in nodes themselves the screenshot will be in the description if you want the access to the full screenshot i'll also put the full file on patreon so if you are a patron um actually i'll put it on for free so if you it doesn't matter if you're a patreon supporter or not you can just download this i think i'll probably do this with most of the spurchalk ones because i think it's a really good platform that people should learn if i change the name from spurtrock group here to pylo taxis if i was to just save this here and then in a new version of blender i can jump in here obviously i don't have anything at the moment this is just a new file but i could append from the one that we just saved node tree you can see that we have filot axis in here as a node group that we can just append and it's a little bit confusing like oh it doesn't show up on this group list but you add group node and then you search here photo taxes there it is all of the controls as we expect so that is how you append and reuse node groups just like just like normal in blender let's do a couple of things now we have this node group we can start actually um making flowers and things so we're just going to make a simple daisy the workflow is just the same as we use for geometry nodes now that we have the node group more or less actually no there are some differences um yeah no there's definitely some differences don't listen to me so this petal that i've just added here it's very simple it's just a few vertices it's just a plane with some subdivisions scaled and bent around a little bit and then i've just subdivided displaced solidify and subdivide again and that just gives us quite a nice little quite nice little petal certainly good enough for what we want today so what i'm going to do is i've got my filet access node group it's just just the same as these nodes and we need to basically position our petal on all of these points and there is uh like duplicate if you're going to seen uh duplicate instancer we're not going to be using this one i'm going to be using objects in let's grab the select the petal get selection just for ease to begin with i'll turn that on at the end but just for now i'm going to leave it off actually so you can see what that looks like the difference there now you might be like why is this in a different place and it's because i haven't applied the location right but if you control the matrices then you can see that it's um it moves it around now this is fine we actually want to create custom matrices based on our points and you can see what goes on there when we do that let's jump in here right the center that we want these to come out of is going to be around about the length of one and these are let's get point two sorry so it's halfway there just so it's approximately third third and third right for petals and center and then we can expand the middle there we go something like this and now all of our petals are going to come out from that center well from the points and it's going to give us space in the middle for our seeds if i click this little button right and you'll see this on some nodes if i click this it will generate a matrix or if you had for example a vector then you can click it and it will create another vector this may not be useful in this case but we are interested in the matrix in and i'm also going to change the viewer so instead of a temporal viewer we're going to use a phase mesh viewer now we have an actual mesh object and if i want smooth shading on this then i have to select my mesh viewer press n and go smooth shading on the side there now what i want to do is i'm going to plug my matrix into here and i'm just going to plug my positions into that location now there's no rotation this is one of the issues that we face we would like that to be proper rotation per point i think this is the easiest way so if we have a point let's just draw a point here like this if we want to work out what the angle is to this point right theta and what we have is its position we have its x value and we have its y value what we can do is we can find out from tan right we can work out if tan theta is equal to opposite over adjacent so y over x then to work out what theta is we can take arctan or a tan of y over x is equal to theta and conveniently there is an operation which sort of does this and that is the atan 2 and you'll see this in the math node in shaders in in the math node here so let's take a vector out and we can basically take our vectored pieces so that we can take our y and our x values from each one of these vectors and just remember that this is a list a long list of every single point we can then take a number scalar math find a tan two so arc tan two and let's just plug these in x and y here we go and let's put this into angle something has happened but it's not enough and that is because angle wants degrees and a tan two here will be outputting radians so let's take another math node set this to degrees and i can just plug that on there boom that's perfect that is exactly what we wanted so this is our said rotation we also want to control our y y rotation yeah our y rotation let's just move things out give us a bit more space right so on our matrix at the moment we're going with axis angle and you can see axis is set let's change this over to euler and this means we now have separate x y z let's plug this into our z and we can now control our y rotation separately our y rotation is going to come off our factor so factor is zero to one range per point and we basically want ones in the middle or ones that have a lower factor to be sort of rotated up a little bit and then ones on the outside so have a higher factor to be rotated down a little bit easiest way for us to do this is with a um mix number node so number there's actually mixed numbers and mixed inputs i'm just going to go with mixed numbers here take our fact into the factor take our value into our y rotation and hopefully yeah there we go so you can see that value two and value one control the top and bottom surface oh sorry the top and bottom petals here we're gonna wanna do something with the scaling as well but just for now let's make sure that we've got something somewhat appropriate definitely too many petals for just like a daisy there we go something like this is probably fine could probably even go fewer petals and i might turn on the post modifiers and that just gives them interest that's looking okay now let's do one for the scale so let's bring this down a little bit further it's a bit more space let's grab uh i mean if i was to plug my factor straight into the scale here then you can see that we basically have zero scaling in the middle one like full size on the outside we want to just search for the curve mapper and let's drop this on here this can be used quite simply it does not automatically update by the way you have to like click update or else you can just play the animation right play the timeline and that will force it up force it to update so i'm just going to make the middle ones very slightly smaller here something like that so this is our so main matrix it's controlling the angle of all of our of all of our petals how about we do a random rotation to angle x because angle x is like the tilt on these and it might be nice just to have a little bit of like positive negative tilt on there let's do let's do the same thing right let's grab a random number generator i want my numbers to be floats i want the size of this set to be the right size for the number of petals so i'm going to take my count here and plug this into my size float low is going to be -1 oh wait no angle in degrees right so let's go from minus minus eight to positive eight i'll do minus eight to eight and let's just plug this in here like so you can see if i change the seed and we just get a little bit of um a little bit movement on there so the great thing about this is it was probably going to give us a little bit more interesting lighting if we have some decent lighting on it and you can see it's just changing it's just changing the the illumination on there now at the moment you can see each one of these petals is individual and i'm just going to hit merge on my mesh viewer turns it into one object and then you can see that we can move it all together that's nice next thing i want to do is jump back into solid view let's add our seeds in the middle this is basically the same process now this is this is one of the things which i love about spurchalk is i can make multiple objects from the same node tree i don't need to make another node tree i can just create another mesh viewer and it's going to output to a different mesh so i can name this first one petals and we can make another one called seeds now it says list index out of range just because there's actually nothing going into it let's plug that in and it's just generated the points to begin with here now i don't want to expand at all because we have we have seeds right we need this to cover the middle i also want to increase the number something like this i might make the radius slightly bigger just so it's cutting off the base of those petals and we're just going to do a couple of simple things so let's grab another matrix here these are going to go into our locations and i want to add a generator ico sphere this is going to be our actual object so here we go radius is going to be much smaller so 0.01 yeah that's actually probably quite good i'm just going to change this down to like 600 for my number of points at the moment it's flat we can change that and it's also got equals uh equal scaling across the whole thing so first of all let's deal with the flatness the easiest way for us to do this is just to add basically to our z position all right so let's grab a vector math node add now you can see if i add something under here we're just moving this up and down you can see at this point even though it's very simple the scene that we have the performance is already starting to struggle this is just an issue with python but you can still create very complex things and i also recommend doing spur chart with geometry notes right so if if i was making a more complex system then i may do something like filotaxis and generate my points here if i were just to plug that in there then you can see i have points and i could go into geometry nodes and i could instance on those points and take advantage of the speed of geometry nodes in this case we're just doing everything with spechock because i think there's maybe not enough exposure to surjack out there and yeah it's a great system so we want to add something to the z position if i was to just add a vector in so this creates a vector and then i was to plug my factor into the z height then you can see that we have this um kind of shoot of points not what we're after but you can see that we have information that we can control so let's take a uh let's take another curve mapper so search for curve upper and i'm going to put this on here and instead of having to like navigate this to be nice and low on here rather than that let's just change the clipping limits here so my maximum y i'm going to set this down to something very low like uh 0.2 hopefully that's low enough update that node that's definitely much too high let's go even lower point one update as that'll do and we actually want to go the opposite direction so let's do that and now you you could totally leave it like this right however i want to have a slight indentation in the middle a little bit of a dip on here something like that maybe a little bit less aggressive something like that is probably okay and i'm also just going to control the size of these as well according to the falloff as we were before sorry the factor so i can do that very simply with just another curve mapper press backspace on it to reset it select my factor into here this into my scale and we're going to bring this up a little bit make sure it's not completely zero in the middle and i'm going to make it increase quite quickly and we're going to go for a few more points now this is kind of why you might want access to the to your i i set it to square root before but you may want access to that power so if i was to add that in here so let's change this to power y and let's plug that in here let's make sure that we have something sensible so let's call it exponent default value of 0.5 just because that's square root so there we go however if you were to increase the value then you can see it increases the packing density in the middle and reduces it on the outside so it's a sort of relative shift towards the middle another thing you may want to do is to lift the um the petals slightly just so they're not cutting off on the edge there so i might just add vector math grab onto the location here change it to add and let's just change this to like 01 something like that just to bump it up slightly so this is looking quite nice already some somewhere between like a daisy and a sunflower sort of thing it's that simple i know this might actually look quite complex but once you get into using shock especially if you've been using geometry nodes then you know this working in parallel just thinking about like what you need to add to what rather than thinking uh like which attribute you need to work on in fact if i just show you my um my geometry notes set up for filet access so obviously you get all the edges as well but if i look in here and i'm trying to work out like as i was earlier today to make sure that i was doing the right process trying to work out what's actually going on where and obviously i have these string nodes because i need to be able to remove attributes at the end to clean up the spreadsheet and stuff like this and i'm going through like okay i've got the multiplier but it's being multiplied by and i have to like follow the noodles it would be a little bit simpler obviously if i was just using regular names um you know like index or angle like i actually am doing here however it's it's still very difficult for me to read this and you know i've got sine going directly into cosine and in terms of the logic that's totally wrong sine and cosine are in parallel they shouldn't be one after the other and then if we compare this with geometry nodes and it's like oh yeah i see i took my thing parallel sine and cos comes out i did my other thing multiplied it over here branching this for my radius um my final radius control like analytically there's just a lot of stuff which uh should make things a little bit easier if you're coming from geometry nose to spur jog you'll probably find it quite refreshing so there we go this has been a pleasure as always i want to do more virtual tutorials let me know if you like this kind of content where it's a little bit more uh kind of free form i'm not going to super edit this i know that people struggle when i over edit videos so i'm just going to leave this a little bit hopefully more approachable more follow along a ball thanks for watching hopefully this has been useful and informative and i will catch you in the next one
Info
Channel: Erindale
Views: 19,357
Rating: undefined out of 5
Keywords: blender, beginner, procedural, nodes, introduction, tutorial, blender tutorial, blender eevee, blender easy, blender easy tutorial, blender 3d, b3d, learn, free, concept art, parametric, computational, design, sverchok, phyllotaxis, phyllotactic
Id: FELFjIw-0d8
Channel Id: undefined
Length: 38min 30sec (2310 seconds)
Published: Sat May 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.