Magic Market | L-Systems

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hi and welcome to this tutorial on houdini l systems in this video i'll go over the process that i use to create the simple plant for the magic market scene our systems might seem scary at first i mean what do all these letters and symbols mean but once you understand that all these letters and symbols are basically just a set of simple directions all that fear falls away and you can start creating some very interesting systems let's begin with the basics the most used symbol will be f think of f as standing for forward so we place an f and move forward a set distance cool now let's move forward again so we place another f simple enough so traveling in a straight line is kind of boring let's turn right to do this we place a plus which means turn right remember these symbols have nothing to do with their usual meaning plus has nothing to do with addition so we've stated that our next step is to turn right next we want to move forward again so we place another f now let's turn left to turn left we use the symbol minus remember it's just step by step directions so we turn left from our current position so if you're using l systems chances are you're going to want to create something that has branching such as a tree branching in l systems is done with square brackets the open brackets represents the start of a branch and closed represents the end of a branch the brackets basically contain extra information separate from the current path we are on so let's start again we'll go forward twice with f f now we're going to turn right but this time it is going to branch off from the current path to do this we drop down a square bracket this is the start of a branch followed by a plus f and close brackets this looks the same as before let's see what happens if we add another f after the brackets the path continues from before the square brackets now if we wanted we could keep traveling up our main path by adding more instructions after the square bracket or we could add more information to our branch by adding more instructions within the square brackets i could continue going over the basics but let's create something a little bit more interesting and learn as we go alright let's get started by dropping down a l system let's dive inside and here we'll find our l system node you see at the moment it's given us this default tree to change that let's go into the rules tab as you can see here this contains all the rules to create this tree since we don't want it let's remove the rules like that and let's type what we created earlier f f square brackets plus f f minus f outside of the square brackets ff and press enter as we can see here this isn't exactly what we created earlier we're missing those right angles to change that we can go up here to the values tab this contains all the global values for our l system the one we interested in is this angle at the moment that 28 i can adjust with the slider i can set this to 90 degrees and that fixes the problem another way of doing it is to go back to our rules create an explicit value so for our turn right instruction with the plus sign let's drop down some brackets and put in the value of 90. let's do the same for our turn left instruction and there we go let's clear this premise and type f f gives us forward forward now let's drop in an a what is a well currently a is nothing so let's give it a value in our first rule let's type in a equals and this is where we'll give a some instructions let's say f plus f square brackets plus f so there we go as you can see we've got ffa which is forward forward and then we bring in a which is f plus f square brackets plus f this is cool because we can now substitute rules into rules giving us the ability to create very complex all systems let's add an a to the end of our rule like this so basically what this is doing is calling a within a so once a is run we call a again let's press enter as you can see we have this now this is controlled with generations you can find generations within the geometry tab up here the moment it's set to 7 we can push it up to 15 and we get something like this let's bring it back down to 7. as you can see if i bring the slider down shrinks bring it up again it grows this generation is controlling how many times we have the rule substitution this is a powerful concept within our systems generations but we'll get back to it later so let's get into one of the plants i created for the magic market scene it has a nice simple structure that will allow us to try a few techniques first things first let's bring up some reference looking at this image we can try to break down its structure we can see that it's broken up into segments at the end of each segment it branches out into three which is made up of two leaves and one flower so let's get started with this plant let's delete what we've created let's drop down a enter a doesn't exist yet so let's create it a equals f and we want it to branch off so square brackets f enter there we go at the moment it looks like a single line but if we activate display points we'll see that we've got two segments the problem is that it's currently pointing straight up we want it to angle down a little bit so to do that let's drop in the symbol and this symbol means angle down let's press enter and see we've got it angled down cool so let's create our other two branches we'll just do exactly what we did with the first one okay we've got three branches here but we can't see it because they're currently sitting on top of each other to fix this we want to roll each branch so to roll it let's put in the symbol put it between that branch and that branch and now we've got a separation but we want an equal angle between them so remember we can set an explicit angle or an explicit value by putting bracket after the symbol and putting the value we want 120. there it is currently we have the first segment of our plant but we want multiple segments to do this we just call a back into our rule at the end here we go now remember this is controlled with the generation amount so if i bring this down push it up as you can see when i'm moving it like this we get a gradual growth i prefer to have it in more of a step in manner so to do that i'm going to disable continuous angles continuous length and continuous width now what i get is this i find this a lot easier to work with when you're trying to get the look of a plant down the next thing i noticed from our reference image is that the stem for the flower is a lot longer than the stem for the leaves now i can adjust the length of the individual stems but i prefer to add some resolution so to add resolution i'm just going to add more segments to do that i'll just add another two f's in our first branch and that gives us this as you can see i now have three segments for this branch now obviously this is too long we need to adjust the length to do that i can go in and within brackets after the ef give it a length of let's say 0.02 that adjusts the first segment so we have to do it for the next two as well there we go we can see we've adjusted each one now this works but it's kind of tedious and it's getting a little bit messy so let's do rule substitution for this let's create a new rule call it b let's just copy and paste what we've done here so b equals what we have over here and now we can remove all of this just leave in that down angle symbol and drop down b so now we're doing a rule substitution we get the exact same result but what i'm going to do for this is remove all of this just keep that single line and instead of calling b and once here i'm going to call it in three times this will make sense further down the road so currently this is too short so let's adjust the length make it slightly longer and let's add another segment let's put another b in there cool so let's do the same thing for the other two the stems that will have the leaves on them they all share the same rule so let's create another rule for them and call it c c equals let's give it a length of 0.01 and let's remove this f and put our c in three times and then the same for this cool so now we have our long stem that is controlled with the b rule and the two shorter ones which are controlled with c so the next thing we want to do is add some shape to the plant at the moment all the stems are straight lines so let's add a little curvature to it we can see from our reference image that the stems which have flowers on the end bend upwards while the small stems of the leaves on the end bend downwards so let's do the one for the flower stems first to do that we're going to use the symbol for an upward bend and we're going to override the global value by putting a value of 10 degrees in brackets as you can see it now bends upwards now let's sort out the smaller stems for the leaves we'll use the symbol for down angle once again override the global value and give it a value of 10 degrees there we go now instead of viewing this as lines and points let's view it as geometry firstly i'm going to disable the display points i'm going to go over to geometry tab and change the type from skeleton to tube at the moment it's a bit of a mess so let's fix that up by going into the tube tab and changing these values of rows and columns let's push it up so that we have more resolution there we go now we can adjust the thickness with the slider over here but for the moment i'm going to keep it at its default now let's have our plant taper on the ends of each branches but also taper overall with each generation if we hover over the thickness scale we'll see this pops up it says how much the exclamation operation will affect the thickness exclamation mark is the symbol used to control the thickness scale so if we go back to our rules and put the exclamation down you can see now that is a slight taper as it goes towards the end let's do the same for our c rule so if we go back to the tube this affects the thickness scale let's drop this down to 0.8 and let's drop the overall thickness to 0.07 so at the moment each branch has a taper what i want to tackle next is to have an overall taper for the plant this needs to be controlled with the generations so to do that let's go back to our rule and for our overall plant put the exclamation mark down now we can see the plant starts and as it goes up tapers off what our plant needs now is a little bit of variation to do this let's add in the symbol followed by brackets and a value of 20. what this means is we'll get a random value for the angle to a maximum of the value we've put in brackets which in this case is 20 degrees so we'll get a random value up to 20 degrees let's do the same thing for this one and choose a value of 10. now let's add a little bit of variation to the main stem let's go to this rule here now that gives the variation i'm looking for but it's also giving me a random angle right from the base which makes the entire plant lean over i want the the plant to come out of the ground straight and then start bending so to overcome this i'll just add a another segment at the base in the premise i will put f and our first segment is straight it's a little bit long so i want to adjust the length to do that drop brackets after the f and give it a value that's better now that we have the main shape of our plant done let's add the leaves flowers and flower buds to do this i'm going to call in some geometry i created with an object merge let's have a look at these geometries on their own there's a leaf here's the flower and here's the flower bud so let's plug in each one of these into our first three inputs if we hover over the input we'll see it says leaf j input leaf k input and leave m input j k and m can then be used within our rules to reference these geometries so let's go back to our system let's add our flower first a flower needs to be put on to the end of the long stem which is at the end of these four b's remember our flower is plugged into our second input k so all i have to do is drop a k over here press enter now if we have a look we can see our flowers on the end let's do the leaves next our leaves are connected into the first input which is j so let's put a j at the end of this and at the end of our second stem now we have some leaves as you can see our leaves and flowers are too small so let's scale them up we can use a transform node let's do the leaves first looking at the plant the next thing i see that needs some changing are the size of the leaves and the flowers at the moment the leaves and the flowers are the same size from the base of the plant up to the tip what i want is for the size to decrease as we go out the plant to do this i will drop in the symbol over here and that will just multiply each generation by this value here so i can shrink it down if i want but i'll leave it at the default value of 0.9 the next problem now is that our stem for our flower is way too long so let's change the length of that by coming in here making it smaller now let's change the length and the thickness of the leaf stems let's change the length first and then to change the thickness all i have to do is put a comma and give this a value i think something like that will be okay let's add some more generations to this let's make it seven if we look at our reference image again you can see that we want the flower buds to appear but only at the top of the plant so to do this let's create another rule so let's go over the rule we just typed on we have the length scaling down with each generation we also have the thickness being scaled down with each generation we now have a segment for the length of 0.02 we then have our first branch which is a downward angle followed by b this rule over here being substituted into it three times and an m which is our third input of our l system we then have it rolling counterclockwise by 120 degrees and then we just repeat that another two times and then i ended up removing the a at the end to use this new rule let's put it in the premise after a the reason for this is i only want the flower buds to appear at the end of the plant and not to be used in each generation as you can see here we now have our three stems with flower buds now if i would like to change the angle of these stems i could always just go in here and give it a value so let's say 20. now i'd have to do it for this one as well and this one over here now this works but if i was unhappy with that value i'd have to go in and change each value there is however a better way of doing this if you come over to the values tab you'll see that we have this variable b variable c variable d we can use this in place of a value so i'm going to use variable b in there in there and over here now if i want to make any changes to it i just have to come over here and adjust it and we'll adjust all three for me so we have b c and e that we can make use of but we can also create our own by coming over here and add in one and we can give it any name we'd like so if we wanted to we could call it flower but for instance and then within our rule we'll just call it so instead of b we'd have flowerbed now at the moment this doesn't look too bad but i'm only using a single type of geometry for the leaves i'd like to add some randomization and variance to this i add in another leaf geometry but as you can see all our inputs for geometry are used fortunately there is a way to add more geometry first of all let's bring in our second leaf geometry we'll now drop a switch node and connect our two leaves into we're going to make use of stampin to do this type in stamp open brackets and the location of our l-system and also a default value now let's go back to our rules and after the j which is our first input we'll just add this this one at the end controls which input we're using in our switch node the first input is zero the second one let's add it to the other j as well we'll make this one zero as you can see we have a combination of our original leaf plus our second one now this isn't exactly random currently we have a leaf one and leaf two leaf one and leaf two leave one and leave two and this happens with eat with each generation so to give it a little bit of randomization let's first duplicate this rule just copy it and paste it here and i'm going to change these to both be from input 0 on the switch node and this first one over here will both be from input 1. we now have identical rules with the only difference being the switch input values this being 1 1 this being zero zero to give this a bit of randomization we're going to use probability to do this all we have to do is add this at the end of our rule 0.5 after a colon this is our probability fifty percent so there's a fifty percent chance that we will use this rule otherwise we'll use this one over here next up i'll go into the geometry tab and mess with this random scale slider a little bit this will just give us slight variations in our scale we can also move the random seed value and this will give us some variations of our plant we can now check these boxes if we like and apply color this plant was one of the simpler plants used in the magic market scene it shows off the basics of l systems hopefully this has given you the building blocks for you to create your own more complex alt systems i hope you found this helpful and until next time goodbye
Info
Channel: Houdini
Views: 40,134
Rating: undefined out of 5
Keywords:
Id: 0vE8GiXhOWM
Channel Id: undefined
Length: 29min 19sec (1759 seconds)
Published: Mon Nov 30 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.