Jump to content

Trying to recreate a venation algorithm.


Recommended Posts

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

Link to comment
Share on other sites

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);
                }
        }
}

 

Link to comment
Share on other sites

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!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8_isolate_gen_fix_prims_add_width_attr.PNG

9_geo_generate.PNG

10_text_output.PNG

6_generation_attrsolved.PNG

7_generation_attrsolved_color.PNG

5_generation_attr.PNG

4_space_colonization_problem.PNG

3_space_colonization2.PNG

1_template_geo.PNG

2_space_colonization.PNG

Edited by Justin K
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...