MrGAG Posted January 23, 2010 Share Posted January 23, 2010 Hello everyone, I am trying to assign random leaves to a growing tree. I used an L-system node to grow the plant, I plugged a circle in the J input of L-system, and there it is I have my leaves. If it were'nt growing I would just isolate "lsysJ" group and work with it to assign different parameters to a leaf. But since my plant is growing, point nums and prim nums are constantly changing during growth. there is something in L-system documentation , but I can't make it work. and the 'param' function seems to be depreciated : The third argument to the J/K/M commands is passed to the connected geometry. Tip You can use this trick to get around the limitation of only three geometry inputs on a L-system. Create all the different models you want (say, 20 different types of leaves) and connect them to a Switch node. Set the switch node’s Select input parameter to param("lsys",0). Connect the switch node to the J input of an L-system node. Now you can insert any of the 20 leaf types using J(,,leaf_number). I guess it can be a good way to assign different parameters to my leaves. by 'stamping' params from l-system node. Could someone point me in the right direction ? Quote Link to comment Share on other sites More sharing options...
Darric Posted January 25, 2010 Share Posted January 25, 2010 (edited) Yeah, that documentation needs some updating. As I'm sure you've figured out, you need to use "stamp" now instead of "param", which works basically identically save for the additional parameter 0 which points to the Lsystem SOP. So on your leaf geometry, it becomes: stamp("../lsystem1","lsys",default_value) (Remember: The stamp name "lsys" can be modified with the "Leaf Param A/B/C" values under the L-system "Funcs" tab.) In addition, that J(,,leaf_number) doesn't seem to be correct anymore - or at least, isn't very useful, as it sets your leaf scale to 0 - but I can get it to work if I use, say, J(0.059,0.0,leaf_number). The first parameter is the leaf scale, which seemingly defaults to roughly 0.059 (?!), I have no idea about the second parameter, and the third is the stamp value. After getting through all that though, you're still left with the problem of randomizing those stamp values in the L-rules, which I'm not sure how to do - or, failing that, to stamp a consistent "leaf number" attribute, which you can then randomize via stamping. I'm not sure how to do that either. If you're OK settling for incomplete randomness, there's the option that they describe in the help (sans all the corrections above!) of merely creating a number of leaf varieties, and switching between them using probabilistic rules, but that sounds pretty tedious to set up. Edited January 25, 2010 by Darric Quote Link to comment Share on other sites More sharing options...
MrGAG Posted January 25, 2010 Author Share Posted January 25, 2010 thank you very much Darric, it's much clearer like that I finally made it work ! To randomize I just wrote : J('','',rand(i)) but having no answer to my question for a some time made me find another solution: Point numbers are constant during growth ( if you check the 'point attributes' parameter in L-system node) but leaves ( primitive ) numbers are not constant at all. So, without using J input, I just added some Cd attribute to points in my l-system rules, making this Cd white where I wanted a leaf. And then, point numbers being constant I can play with the 'leaf points' and copy stamp some parameters to them. Like that I can work with lighter template. I add some spring chop to L-system; it is yet pretty heavy, but with the leaves it would have just been unpracticable, I guess. anyway, thanks a lot, I now know how to stamp paramters from a L-system, pretty cool Quote Link to comment Share on other sites More sharing options...
Darric Posted January 27, 2010 Share Posted January 27, 2010 I just tried what you suggested (using rand(i), or rather in my case, stamping "i" and randomizing it in the stamp expression) and it does seem to work - the help lists that value as "The offset into the current L-system string where the rule is being applied" which... I'm not sure I entirely understand - or rather, if it means what I think it does, then I'm not convinced that that value will remain unchanged for all L-systems as they grow. I also just saw the help for the leaf command now, which clarifies my earlier discoveries: J(s,x,a,b,c) - where s is scale (apparently defaulting to step size, but that doesn't seem accurate), x is not used and should be set to 0, and a/b/c are your stamp values. Regardless of all that, I'm glad you got it working. Quote Link to comment Share on other sites More sharing options...
MrGAG Posted January 29, 2010 Author Share Posted January 29, 2010 Hello, here is the result I've got so far 1 Quote Link to comment Share on other sites More sharing options...
Darric Posted January 29, 2010 Share Posted January 29, 2010 Looking good, I'd love to see a video. Quote Link to comment Share on other sites More sharing options...
zzhj Posted September 7, 2016 Share Posted September 7, 2016 On 2010/1/29 at 9:19 AM, MrGAG said: Hello, here is the result I've got so far woo,cool,would did you share your hipfile or a tutorial,i am really interested. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.