Ballington Posted November 23, 2020 Share Posted November 23, 2020 I've found this paper which explains an algorithm for generating natural looking leaf veins. http://algorithmicbotany.org/papers/venation.sig2005.pdf The main part that I'm focusing on is in page 5, with "3.4 Example" linking to figure 6. I've been using a solver and have tried recreating their system, step-by-step but I've run into problems. I have attached what I created in this post, and tried my best to comment on the process. If you follow alongside the paper you should be able to see my thought process. Here are my issues. I haven't used their system found in steps F to J (regarding auxin point generation), I figured that if I just scatter points as this was more of a direct approach to creating points, vs their more complicated and somewhat vague explanation about how they scatter points and remove some based off some criteria (I'm still not sure what determines points to be deleted in their system). I'm not entirely sure if just scattering outright is the correct approach. Next is I don't really know how to progress from what I have made. I seem to be up to step E, but looking at the way the system works I don't think I really need to progress past that point. My thoughts are that A-E are all the steps I need to create in order for it to loop as it's just a matter of scattering points, finding the nearest ones and moving in a direction. In the solver, if I press play the whole system just stops working after frame 1. I think this is down to a lack of understanding of how the solver works, but I'm ultimately not sure whether it's actually down to my network being broken, or me not setting up the solver correctly. My final problem is this. Further down in the paper (page 8, figure 9) they show a number of natural looking leafs. But just thinking of how they constructed their system in figure 6, I can't help but to think it'll just end up producing a chaotic mess. You start off with 1 point, it moves in a random direction, then the next iteration has 2 points, which move in a random direction, then I'd have 4 points moving in a random direction. Surely after multiple iterations of this process I'll just end up with a weird mess of points that moved chaotically and I'll just have an ugly looking mess. But I can't determine where the paper helps to stop this from happening and causing it to create a natural looking structure. This is the first time I've tried to recreate a system found in a paper, so I will admit I'm not that experienced when it comes to converting more academically write text into something that translates into houdini, but I would really appreciate the help if somebody has more knowledge in this area. venation.hip Quote Link to comment Share on other sites More sharing options...
Librarian Posted November 23, 2020 Share Posted November 23, 2020 Maybe It Helps.I have This In The Shell Of OdF int handle; int seed_ptnum; handle = pcopen(1, "P", @P, 99999, 1); while(pciterate(handle)){ pcimport(handle, "point.number", seed_ptnum); i@seed = seed_ptnum; } --------------------------------------- int handle; int seed_ptnum; handle = pcopen(1, "P", @P, 9999, 1); while(pciterate(handle)){ pcimport(handle, "seed", seed_ptnum); if(@ptnum == seed_ptnum){ i@treetop = 1; }else{ i@treetop = 0; } } ------------------------------------------------ float food_radius = chf("radius"); int max_food = chi("neighbours"); float step_length= chf("step"); int prim; if(@treetop == 1){ int handle; int count_ptnum = 0; handle = pcopen(1, "P", @P, food_radius, max_food); if(pciterate(handle) != 0){ vector target_goal = set(0,0,0); while(pciterate(handle)){ vector food_position; float fertility; pcimport(handle, "P", food_position); pcimport(handle, "fertility", fertility); target_goal += normalize(food_position - @P) * fertility; } if(length(target_goal) >0.01){ vector next_position = normalize(target_goal) * step_length + @P; int next_ptnum; next_ptnum = addpoint(geoself(), next_position); prim = addprim(geoself(), "polyline"); addvertex(geoself(), prim, @ptnum); addvertex(geoself(), prim, next_ptnum); } } } Quote Link to comment Share on other sites More sharing options...
Justin K Posted November 24, 2020 Share Posted November 24, 2020 (edited) Hey Ballington, Its been awhile since I have worked with this stuff. I have successfully gotten a leaf venation system to work, building off of the efforts of those who have gone before me. It turns out, the most efficient method to get you started with leaf venation is a reuse of the space colonization algorithm showcased here: Now i guess it depends on what your goals are. I wanted to make realistic veins for texturing displacement. Using seeds to randomize the result. This is quite possible. Ive attached some picks that show the system working based off entagma's code. There is a problem though. The algorithm is not intelligent enough to organize the resulting geo in a logical manner. Its a madhouse of prims and points, trust me. Thats where you come in. You need to create a logical system to help with the creation of geometry itself. First, you need a generational pattern. Main stem, first gen, next stem, second gen etc. Ive attached a pick that shows the logic of this process. Once you have a generation setup, you can loop through each generation using connectivity, and create a a width attribute along each 'vein' this will be what drives the size of each vein when you actually add geo. Ive shown some picks of a nice result. You can then literally project this geo onto a heightfield and export a displacement texture. Now its challenging and there are all sorts of loopholes along the way. I wish I could show you the code, but its not soemthing I am allowed to share. All the best mate! Edited November 24, 2020 by Justin K 2 Quote Link to comment Share on other sites More sharing options...
Librarian Posted November 24, 2020 Share Posted November 24, 2020 (edited) You have algorithm here with files that can be Adapt to any shape .Have Fun Just Playing with regular grid and Changing some Parm Endless Fun Edited November 24, 2020 by Librarian Quote Link to comment Share on other sites More sharing options...
Librarian Posted December 2, 2020 Share Posted December 2, 2020 Didn't see. Nice Tutos With File 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.