Loved the video. It has a great explanation. I couldn't find how to implement randomness into L systems on UA-cam, but I found it in this video. I'm a third-year undergraduate at the University of Greenwich, doing a thesis on procedurally generating flora for game-ready assets. I am implementing an L system in Python for Blender.
I'm really glad it was helpful. I'd love to see the thesis when it's done if you don't mind sharing. As you can probably tell procedurally generated assets, and especially plants, are one of my favorite topics. Through our on-campus game studio we've worked with procedurally generated opponents (not plants) - you might want to check out Project Hastur store.steampowered.com/app/800700/Project_Hastur/ The creatures are procedurally generated.
Hm, if you're already just growing the lines in this manner, maybe you could use Brownian motion when splitting lines? This would create more interesting lines maybe?
What do you mean by using Brownian motion? I like the idea of adding more randomness to the branching, but I'm not sure how to apply Brownian motion in particular.
@@programmingchaos8957 Alright, it will be a little tricky to express this in text form, especially since it's been two weeks since I watched this and I may have forgotten some things, but I'll try my best! I'll express random chance as [10%:A,30%:B,20%:C,40%:D] S > FB, F > (F[25%:W,25%:D,25%:S,25%A]F), and B > (LFB)(RFB). W, A, S, and D all represent the joint between two Fs being moved up, right, left, or down. You'd probably want to have one to two bytes to store the up/left variations instead of just 4 possibilities, it would also have to be assumed that the variance decreases based on how many parentheses it is surrounded by or else the positional variations would outweigh the length of the line itself! That or the variations would shrink over time, both are undesirable. Some unfortunate problems with this are that it does not affect the vertex branches lie on meaning that it only has so much possible variation.
8:58 That's a very efficient way of doing it! I might just have stored each line individually, the only unfortunate thing is that you lose the ability to easily have small unique traits for each line. Whether it is just a bit of random noise or something else entirely.
That's a good approach for less bush-like trees. If you want to make softwoods (spruce, pines, etc.) you take that to the extreme with a single trunk and branches sticking out at almost 90 degrees.
Processing (free to download and easy to install from processing.org). The language is Java, Processing is just a simplified environment with easy to access graphics routines.
Good question. I haven't done a ton with wave function collapse. I've only seen/tried it with 2D titled forms where it is used to determine which pattern goes in each tile. I assume it could be applied to 3D voxels/cells as well. So, it could be used for 3D trees like the ones here. For L-Systems you can 'turn up' the randomness by adding random noise to the angles, so I'm not sure that either one necessarily has more randomness. If anything I feel like wave function collapse may be less random because of the (usually) limited number of patterns that can go in each tile/cell as opposed to random noise allowing for any branch angle with an L-System. WFC requires a branch cell to be at a specific angle so that the branches link up with the next cell. On the other hand with WFC you can more easily define specifics like branches end with a leaf, or there are options for a branch has a nest on it, or a branch is broken off, or a branch has a flower. So maybe WFC allows for more variety more easily - a rare nest or broken branch. Whereas, L-Systems allow for more 'noise' with trees that have the same elements. But that's just a guess. A minor flaw on my part, but whenever it comes up I have to point out that WFC is a particular application of that more general category of constraint satisfaction problems. Which is nice if you're interested in WFC, because there are many heuristics for speeding up constraint satisfaction problems that can be applied equally well to WFC.
It occured to me that with a stochastic L-System, it would be possible to add a very rare options like a nest or flower. E.g. 99% of the time F->FF, but 1% of the time F->FNF where N stands for nest, or some other rare addition. I would guess that in the end the two approaches have equal(?) capabilities, but certain effects are easier to achieve with one approach or the other.
With randomness I was thinking for example if the starting image is 16x16 and 3 different colours you have 768 possible starting images (obviously you would probably have a larger image and not all combinations will work very well) also I know wave function collapse technically uses a 2D/3D array* not images but it's just an example. *this is also called a domain.
1:54 Huh, that's an odd way of doing it! Instead of starting out with a line of X length it is growing to that size over the course of several iterations.
Having the trees grow is a cool way to go. But it's surprisingly hard to get it to look right. So, I took the simpler approach (also shorter for the video) of only worrying about full sized trees.
@@programmingchaos8957 I don't know, your trees seem to be growing to me, they start out as just a single stick and bulb FB then they become two sticks with two sticks arcing out where the bulb used to be with their own bulbs as well. The only problem is that it is not smooth growth, it doubles in size every iteration! If you could smoothly transition between the different iterations, then simply iterating would result in growth.
Please, make an effort and publish _A REAL_ tutorial, with text, pictures, when necessary - video fragments. What you demonstrate here - is not a tutorial, it is a show-off, self-advertisement. Don't be like a billions of Patels flooding the youtube.
I've been trying to do that. But getting the right level of detail in a reasonable amount of time it tricky and without feedback I don't have a great sense of what viewers already know or don't. This particular video is a partial 'part 2' to the linked video on L-Systems ua-cam.com/video/z7LeTu94qEc/v-deo.html which goes a little slower and has some more details. I'm curious if there's something in particular that's missing. Two topics that I was worried about I was covering too fast were classes and transformations (e.g. pushMatrix, popMatrix, translate, and rotate). Were those the issue, or something else? Thanks.
@@programmingchaos8957 You just admitted you did a lazy job. My advice to you - never do anything you will be ashamed of later on. No matter how hard it is - do a good job. As per 'what viewers already know or don't' - have you EVER read any textbooks? Proper tutorial is arranged by levels, and it should cover as many levels as possible. From beginner to the level of the creator. You are welcome.
Thank you, but I must politely disagree - I said I was working hard at a tricky task. It does take a lot of work to generate these videos and I am happy with the results. Although I'm always looking for places to improve and welcome feedback. I totally agree that a course - or textbook - would start at a particular level of ability and cover a set amount of material. If you are looking for a course on programming there are many excellent one's on-line. In contrast I don't expect everyone to start at video one and watch them in order as if this were a course. These are meant to be mostly stand-alone videos. Something for someone who wants to learn about reaction-diffusion systems or L-systems, etc. - which is why I expect to get viewers with a range of skills. I suspect part of the confusion is simply that there are two commonly used definitions of the word tutorial: "a period of instruction given by a university or college tutor to an individual or very small group." and "an account or explanation of a subject or task, especially as an online video". I'm using the second definition and am sorry for any confusion regarding the scope of the videos it may have created.
@@KD56100 you clearly don't know how hard it is to make actaly good coding videos. editing is a long and gruling process and takes many hours to produce a good final product even then you probably had to cut out 99% of your work so people don't get bored after 10 seconds of watching you video. This man has managed to make an interesting and compelling video that lasts over 30 minutes a feat I have not yet achieved.
Hurray! Another tutorial of Programming Chaos. Getting more and more tools in my programming toolbox. Thanks Terry.
Thanks! I'm having fun putting these together, and it's a good excuse to review some interesting topics.
Loved the video. It has a great explanation. I couldn't find how to implement randomness into L systems on UA-cam, but I found it in this video. I'm a third-year undergraduate at the University of Greenwich, doing a thesis on procedurally generating flora for game-ready assets. I am implementing an L system in Python for Blender.
I'm really glad it was helpful. I'd love to see the thesis when it's done if you don't mind sharing. As you can probably tell procedurally generated assets, and especially plants, are one of my favorite topics. Through our on-campus game studio we've worked with procedurally generated opponents (not plants) - you might want to check out Project Hastur store.steampowered.com/app/800700/Project_Hastur/ The creatures are procedurally generated.
you are my favourite #1 youtuber i love you!!!
Thank you! That totally made my day!
Hm, if you're already just growing the lines in this manner, maybe you could use Brownian motion when splitting lines? This would create more interesting lines maybe?
What do you mean by using Brownian motion? I like the idea of adding more randomness to the branching, but I'm not sure how to apply Brownian motion in particular.
@@programmingchaos8957 Alright, it will be a little tricky to express this in text form, especially since it's been two weeks since I watched this and I may have forgotten some things, but I'll try my best! I'll express random chance as [10%:A,30%:B,20%:C,40%:D] S > FB, F > (F[25%:W,25%:D,25%:S,25%A]F), and B > (LFB)(RFB). W, A, S, and D all represent the joint between two Fs being moved up, right, left, or down. You'd probably want to have one to two bytes to store the up/left variations instead of just 4 possibilities, it would also have to be assumed that the variance decreases based on how many parentheses it is surrounded by or else the positional variations would outweigh the length of the line itself! That or the variations would shrink over time, both are undesirable. Some unfortunate problems with this are that it does not affect the vertex branches lie on meaning that it only has so much possible variation.
@@flameofthephoenix8395 Got it! That is a cool idea. If I get the chance I'll try it out. Or let me know if you try it.
@@programmingchaos8957 Hm, yeah! If I've got time, I might try something like that.
8:58 That's a very efficient way of doing it! I might just have stored each line individually, the only unfortunate thing is that you lose the ability to easily have small unique traits for each line. Whether it is just a bit of random noise or something else entirely.
Thanks! There are several approaches that represent tradeoffs between efficiency and the amount of detail you can store.
@@programmingchaos8957 When it comes to storing every step required to draw the tree your method is probably about as efficient as you get!
1:00 Hm, it might be worth having extra branches at varied points along the trunk, this will prevent it from looking too orderly and artificial.
That's a good approach for less bush-like trees. If you want to make softwoods (spruce, pines, etc.) you take that to the extreme with a single trunk and branches sticking out at almost 90 degrees.
@@programmingchaos8957 Interesting! I suppose you'll want more leaves for the bush-like ones too, and less for the pines and spruce.
What platform are you using to code??
Processing (free to download and easy to install from processing.org). The language is Java, Processing is just a simplified environment with easy to access graphics routines.
Dont you think something like wave function collapse will work the same if not better as it is more random
Good question. I haven't done a ton with wave function collapse. I've only seen/tried it with 2D titled forms where it is used to determine which pattern goes in each tile. I assume it could be applied to 3D voxels/cells as well. So, it could be used for 3D trees like the ones here. For L-Systems you can 'turn up' the randomness by adding random noise to the angles, so I'm not sure that either one necessarily has more randomness. If anything I feel like wave function collapse may be less random because of the (usually) limited number of patterns that can go in each tile/cell as opposed to random noise allowing for any branch angle with an L-System. WFC requires a branch cell to be at a specific angle so that the branches link up with the next cell.
On the other hand with WFC you can more easily define specifics like branches end with a leaf, or there are options for a branch has a nest on it, or a branch is broken off, or a branch has a flower. So maybe WFC allows for more variety more easily - a rare nest or broken branch. Whereas, L-Systems allow for more 'noise' with trees that have the same elements. But that's just a guess.
A minor flaw on my part, but whenever it comes up I have to point out that WFC is a particular application of that more general category of constraint satisfaction problems. Which is nice if you're interested in WFC, because there are many heuristics for speeding up constraint satisfaction problems that can be applied equally well to WFC.
It occured to me that with a stochastic L-System, it would be possible to add a very rare options like a nest or flower. E.g. 99% of the time F->FF, but 1% of the time F->FNF where N stands for nest, or some other rare addition.
I would guess that in the end the two approaches have equal(?) capabilities, but certain effects are easier to achieve with one approach or the other.
Ok
With randomness I was thinking for example if the starting image is 16x16 and 3 different colours you have 768 possible starting images (obviously you would probably have a larger image and not all combinations will work very well) also I know wave function collapse technically uses a 2D/3D array* not images but it's just an example. *this is also called a domain.
Ah, that makes sense. I think that could work very well and might give a lot more variability. @@Lawtro
1:54 Huh, that's an odd way of doing it! Instead of starting out with a line of X length it is growing to that size over the course of several iterations.
Having the trees grow is a cool way to go. But it's surprisingly hard to get it to look right. So, I took the simpler approach (also shorter for the video) of only worrying about full sized trees.
@@programmingchaos8957 I don't know, your trees seem to be growing to me, they start out as just a single stick and bulb FB then they become two sticks with two sticks arcing out where the bulb used to be with their own bulbs as well. The only problem is that it is not smooth growth, it doubles in size every iteration! If you could smoothly transition between the different iterations, then simply iterating would result in growth.
Please, make an effort and publish _A REAL_ tutorial, with text, pictures, when necessary - video fragments.
What you demonstrate here - is not a tutorial, it is a show-off, self-advertisement. Don't be like a billions of Patels flooding the youtube.
I've been trying to do that. But getting the right level of detail in a reasonable amount of time it tricky and without feedback I don't have a great sense of what viewers already know or don't. This particular video is a partial 'part 2' to the linked video on L-Systems ua-cam.com/video/z7LeTu94qEc/v-deo.html which goes a little slower and has some more details. I'm curious if there's something in particular that's missing. Two topics that I was worried about I was covering too fast were classes and transformations (e.g. pushMatrix, popMatrix, translate, and rotate). Were those the issue, or something else? Thanks.
@@programmingchaos8957 You just admitted you did a lazy job. My advice to you - never do anything you will be ashamed of later on. No matter how hard it is - do a good job. As per 'what viewers already know or don't' - have you EVER read any textbooks? Proper tutorial is arranged by levels, and it should cover as many levels as possible. From beginner to the level of the creator. You are welcome.
Thank you, but I must politely disagree - I said I was working hard at a tricky task. It does take a lot of work to generate these videos and I am happy with the results. Although I'm always looking for places to improve and welcome feedback. I totally agree that a course - or textbook - would start at a particular level of ability and cover a set amount of material. If you are looking for a course on programming there are many excellent one's on-line. In contrast I don't expect everyone to start at video one and watch them in order as if this were a course. These are meant to be mostly stand-alone videos. Something for someone who wants to learn about reaction-diffusion systems or L-systems, etc. - which is why I expect to get viewers with a range of skills. I suspect part of the confusion is simply that there are two commonly used definitions of the word tutorial: "a period of instruction given by a university or college tutor to an individual or very small group." and "an account or explanation of a subject or task, especially as an online video". I'm using the second definition and am sorry for any confusion regarding the scope of the videos it may have created.
@@KD56100 you clearly don't know how hard it is to make actaly good coding videos. editing is a long and gruling process and takes many hours to produce a good final product even then you probably had to cut out 99% of your work so people don't get bored after 10 seconds of watching you video. This man has managed to make an interesting and compelling video that lasts over 30 minutes a feat I have not yet achieved.
@@Lawtro oh, poor thing! Don't cry please.